By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Metrics are cheap. Datasets are expensive and valuable. A mediocre metric on a great dataset beats a great metric on a random one, every time. This lesson is about building the dataset that will carry you through Modules 6 to 9.
Every RAG evaluation row has four useful fields, and one optional one:
{
"id": "q_014",
"question": "Can I return a sale item?",
"expected_answer": "Yes, within 14 days of delivery, for store credit. Worn items are excluded.",
"expected_sources": ["returns-policy"],
"tags": ["returns", "high-traffic", "rule-sensitive"],
"notes": "Added after the Q3 incident; sale items are store credit only."
}| Field | What it enables | If you skip it |
|---|---|---|
| question | Everything — it is the input | You have no test |
| expected_answer | Completeness scoring, judge calibration | You can only measure relevance and faithfulness |
| expected_sources | Retrieval precision and recall — the fastest tests you have | You cannot tell a retrieval bug from a generation bug |
| tags | Stratified sampling, partial runs, coverage reporting | Every run costs the same and covers the same intents |
| notes | Why this case exists (usually a real incident) | Nobody dares delete it, and nobody knows why it is there |
Top intents from support tickets. Take the last 90 days, cluster into 10–15 intents, write 3–5 questions per intent. This gets you to about 50 cases with real traffic behind them.
Your Module 1 failure report. Every failure you found by hand becomes a case with the correct expected answer. These are the highest-value rows you will ever add.
Documents, read backwards. Take each help-centre article and write the question it answers. This is the fastest way to find gaps in retrieval.
Edge cases from the product owner. Countries you do not ship to, items you do not return, customers with no order history.
Negative cases. Fifteen questions whose answer is genuinely not in the corpus. These test refusal, and they are the ones that catch hallucination.
| Bucket | Share of dataset | Purpose |
|---|---|---|
| Common happy path | 40% | Catches regressions in what most users actually ask |
| Rule-sensitive | 20% | Refunds, safety, policy exceptions — zero tolerance |
| Edge cases | 20% | Unusual countries, items, states |
| Unanswerable / negative | 20% | Refusal correctness, anti-hallucination |
If your dataset is 100% happy path, your scores will be beautiful and your product will still embarrass you in week one.
RAG rows are single question/answer pairs. Agents need a slightly bigger shape: a scenario with a history and an expected tool trace.
{
"id": "a_003",
"turns": [
"Hi, I'm Priya. Order 4521 arrived damaged.",
"I don't want a replacement, I want my money back."
],
"expected_tools": ["lookup_order:4521", "start_return:4521"],
"forbidden_tools": ["issue_refund"],
"expected_behaviour": "Offer a return, explain that refunds are processed after the item is received, never promise an instant refund.",
"max_steps": 6
}Note the forbidden_tools field. Negative assertions are more valuable than positive ones for agents: an agent that does the right thing and the wrong thing is still broken.
Key takeaways
A RAG row is question, expected answer, expected sources, tags and a note.
expected_sources unlocks the fastest tests you have — retrieval precision and recall.
Balance the dataset: happy path, rule-sensitive, edge cases, unanswerable.
Agent rows need a scenario, expected tool trace and forbidden tools.
Datasets go stale; date them and review them.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.