The RAG triad
Split every bad answer into three failures. Context relevance, groundedness, and answer relevance answer different questions, and a low score on each one sends you to a different part of the system.
A diagnostic Three questions
An average of the three scores tells you the demo got worse. It does not tell you what to change.
In a design interview, walk a failure to one stage and name the fix. “The model hallucinated” names a symptom. “Context relevance was fine, groundedness dropped after we merged parent nodes, so the extra context added unsupported detail” names the stage, the change that caused it, and the mechanism.
The three failures Memorize this table
Each row is a different owner. Mixing them produces a prompt change for a retrieval bug, or a new retriever for an out-of-scope question.
| Metric | Question it answers | If it is low, you change |
|---|---|---|
| Context relevance | Did retrieval return the right passages? | Chunking, embedding, top-k, query rewrite, hybrid search |
| Groundedness | Is the answer supported by those passages? | Prompt, context packing, citation rules, model |
| Answer relevance | Did it actually answer the question? | Query understanding, routing, or the question was out of scope |
Out of scope is a product decision sitting in the third row: the corpus has no passage, and the correct behavior is a refusal. Retrieving a neighboring section and answering from it will raise neither groundedness nor answer relevance. It spends tokens to sound helpful.
Architect's lens
Context relevance can look healthy while the answer is still wrong, because the parent you merged in does contain the right section. The damage shows up as groundedness: the model now has extra sentences it can blend into a claim no sentence actually makes. Read the pair of scores, not the average.
Walk one failure Handbook example
One question, three designs, three different low legs. This is the interview walk.
The question and the corpus
“When can a new hire enroll in the health plan?” The health section says new hires enroll on the first day of the month after 30 days, and part-time employees enroll after 90 days. A later dental section says dental coverage begins after 6 months. The PTO chapter also says “30 days.”
| Design | What came back | What the model said | The low leg |
|---|---|---|---|
| Baseline, large fixed chunks | The PTO chapter, because “30 days” is in the embedding’s neighborhood. | “After 30 days.” The number is in the chunk. The policy is the wrong policy. | Context relevance. Retrieval returned a related passage. Groundedness can still pass, which is why a single “hallucination” label misses it. |
| Sentence window around the health sentence | The enrollment sentence plus the part-time neighbor. | The first of the month after 30 days, with the part-time exception. | None. The match was the sentence. The window carried the exception. Tokens stayed small. |
| Auto-merge of the whole benefits parent | Health and dental, because enough child chunks hit. | “Health coverage begins 6 months after the first of the month.” A blend of the two sections. | Groundedness. Context relevance stayed fine — the parent contains the health rule. The extra section supplied a number the model folded into a rule the passages do not state. |
The principal sentence for the third row: context relevance was fine, groundedness dropped after we merged parent nodes, so the extra context added unsupported detail. The fix is the merge threshold or the choice of pattern, not a new embedding model and not a longer system prompt that still receives both sections.
Name the fix One stage
The course’s two retrieval patterns are chunking options on the first row. They are not a remedy for the other two.
Context relevance
- Sentence-window when the fact is a sentence and the chunk was too coarse to match it.
- Auto-merging when small chunks match pieces of a section and the section is the right unit.
- Embedding, top-k, query rewrite, or hybrid search when the chunk shape is already right and the rank is still wrong.
Groundedness
- Narrow what you pack. A wide window and a low merge threshold are context-packing bugs.
- Require the answer to cite the span it used, and drop claims with no span.
- Change the prompt or the model only after the packed text itself is the text you meant to send.
Answer relevance
- Rewrite or route the query when users ask in a form the index does not match.
- Refuse when no marked source passage exists for that question.
- Leave the retriever alone. More context makes an off-question answer longer.
What you must be able to do
- State the question each metric answers, and the class of change a low score allows.
- Walk one bad answer to one stage, including a case where retrieval “succeeded” and groundedness fell.
- Keep sentence-window and auto-merging on the context-relevance row unless the packed text itself caused the groundedness drop.
Key takeaways
- The triad is a split, not a leaderboard. Report the three legs and the token count.
- A grounded answer can still be the wrong policy, if the passage that supported it was the wrong passage.
- Extra context is a groundedness risk. Merging a parent can hold context relevance and still invent a blended rule.