Building and Evaluating Advanced RAG
A two-hour course: a baseline pipeline, the RAG triad, sentence-window retrieval, and auto-merging retrieval. Completing the notebooks is literacy. Hireability is being able to diagnose a bad answer and choose a retrieval design because the metrics moved.
What you are hired for Principal scope
A Gen AI solution architect owns the failure and the design choice. The library calls are how you run the lab.
Literacy
You can stand up a naive RAG pipeline, score it with the triad, and swap in sentence-window or auto-merging retrieval.
Hireability
You can point at one failing stage, name the fix, and refuse a more complex retriever when the baseline already fits the budget.
Architect's lens
LlamaIndex builds the index and the retriever. TruLens asks the three questions. Neither one decides whether a wider window was worth the tokens. That decision is the role.
The two ideas What the course is for
Everything else in the notebooks is a way to practice these.
| Idea | The skill | Where to go deep |
|---|---|---|
| The evaluation loop | Freeze a set, change one design, keep the change only when the failing metric moves inside the budget. | Also the RAG triad, which tells you which metric moved and why. |
| The chunk-size tradeoff | One chunk size cannot both match and explain. Split the unit you embed from the unit you hand the model. | Sentence-window for a specific fact. Auto-merging when the answer lives in a section. |
The lines worth practicing out loud are collected onInterview lines.
The two-hour course Lab map
Four lessons. Each one leaves a design judgment, not an API.
| Lesson | What the lab builds | What you leave able to say |
|---|---|---|
| Baseline pipeline | Naive RAG: fixed-size chunks, embed, top-k, generate. | The score everything else has to beat, including its token cost. |
| RAG triad | Context relevance, groundedness, and answer relevance on each answer. | Which stage failed, and the class of fix that stage allows. |
| Sentence-window | Embed a sentence. Hand the model the surrounding window. | Use it when the fact is a specific sentence and the neighbors carry the meaning. |
| Auto-merging | Index a parent–child hierarchy. Replace children with the parent when enough of them hit. | Use it when the source has real sections and the answer lives at section level. |
Cheat sheet Recap
The track, in the order you would defend a design.
1. Evaluation loop
Questions, source passages, and a definition of wrong — frozen before you touch chunk size.
2. RAG triad
A diagnostic. One low leg names the stage. A single blended score hides it.
3. Chunk-size tradeoff
Sentence-window or auto-merging. Wider context raises tokens and can drop groundedness.
3a. Routing a mixed corpus
Match the chunker to the element. Use an LLM only when extension, parser output, and heuristics are ambiguous.
4. Interview lines
Four answers that show you can diagnose, choose, and stop.
Key takeaways
- The evaluation loop and the chunk-size tradeoff are the course. The APIs are how you measure them.
- Walk a bad answer to one stage. Context relevance, groundedness, and answer relevance fail for different reasons and take different fixes.
- Precision, context, and cost move together. A wider window or an aggressive merge is a budget decision, not a default upgrade.