Index cards sorted into labeled stacks on a desk, representing a curated test dataset

Golden Datasets for LLM Apps: Build and Version Them

Every eval number you have ever trusted was only as good as the list of examples behind it. Teams spend weeks choosing between metrics, then run them on forty questions somebody typed into a spreadsheet during a standup. Golden datasets for LLM apps are the curated, labeled, versioned example sets that your prompts, retrievers, and agents are measured against. Get this asset right and almost any metric works. Get it wrong and the fanciest framework is just a random number generator with a dashboard.

A golden dataset is not a benchmark you download. It is a living record of what your users ask, what a correct answer looks like for your product, and which failures you have already paid for once. This article walks through where the rows come from, what a row should contain, how to review labels, how to keep the set from rotting, and how to version it so a score today means the same thing as a score last quarter.

What “golden” actually means

Golden does not mean perfect or exhaustive. It means trusted: a human who understands the product has looked at each row, agreed on what good looks like, and written it down. A thousand scraped prompts with no labels is a log file. Eighty rows with reviewed expected behavior, tagged by scenario, is a golden set.

The label does not have to be a full reference answer. For many apps the right “gold” is a set of constraints: the answer must mention the 30-day refund window, must not promise a delivery date, must cite document 14. Constraint-style labels are easier to write, easier to review, and friendlier to automated graders than a paragraph of ideal prose that no model will ever reproduce word for word.

Seven sources for your first rows

You do not need a large dataset to start; you need honest ones. In rough order of value:

1. Production traces. The best questions are the ones real users asked. Sample from logs, deduplicate near-identical queries, and strip personal data before anything leaves the logging system. 2. Support tickets and chat transcripts. Especially escalations and “the bot got this wrong” tags. These are pre-labeled failures. 3. Bug reports. Every fixed hallucination or bad refusal becomes a permanent regression row. 4. Subject-expert authored cases. Ask a support lead or domain specialist to write the twenty questions that would embarrass the product. They know edge cases you do not. 5. Adversarial and boundary cases. Empty input, mixed languages, injection attempts, questions outside scope that should be refused. 6. Document-derived questions. For a RAG system, pick random passages and write (or generate and then review) questions each passage answers. Good for retrieval coverage; weak for real-user phrasing. 7. Synthetic expansion. Use a model to paraphrase or generate variants of rows you already trust. Treat these as secondary: mark them, cap their share, and never let them dominate the set.

Before you have traffic, lean on sources 4 through 6. After launch, shift the weight to 1 through 3 and let the set drift toward reality.

Anatomy of a row

A row needs enough structure that you can slice results later. A JSONL schema that works for most apps:

{
  "id": "refund-0042",
  "input": "Can I return a laptop after 45 days if it's unopened?",
  "context_ids": ["policy-returns-v3#sec2"],
  "expected": {
    "must_include": ["30 days", "unopened"],
    "must_not_include": ["guarantee"],
    "reference_answer": "Returns are accepted within 30 days..."
  },
  "tags": ["policy", "numeric-edge", "needs-refusal-or-redirect"],
  "source": "support-escalation",
  "added": "2026-11-02",
  "reviewer": "ak",
  "difficulty": "medium"
}

Each field is there for a reason. id gives you stable references across versions. context_ids lets you check retrieval separately from generation. tags let you report accuracy by scenario instead of one blended average. source tells you later whether synthetic rows are inflating your numbers. reviewer and added make audits possible.

Tag by failure mode, not by topic

Teams default to topical tags like “billing” and “shipping”. Those help product managers but not engineers. Add tags describing how the system can fail: lexical identifier lookup, paraphrase, multi-hop, stale document, ambiguous question, out-of-scope refusal, long input, tool selection. When a prompt change moves overall accuracy by one point, failure-mode tags show whether it traded paraphrase handling for refusals, which a single average hides.

This is the same logic behind slicing in the RAGAS evaluation guide: a retrieval recall drop on identifier queries needs a different fix than a drop on paraphrases.

Review the labels like code

Label noise caps your measurable accuracy. If 10% of expected answers are wrong, a perfect system scores 90% and you will chase phantom bugs.

  • Two-person review for a sample. Have a second reviewer label 20% of rows blind. Where they disagree, the question or the criteria are ambiguous; fix the row or drop it.
  • Review the failures first. When a candidate system “fails” a row, spend two minutes checking the label before touching the prompt. In early iterations a large share of failures turn out to be bad gold.
  • Write a one-page labeling guide. How strict is “mentions the refund window”? Is a hedged answer acceptable? Without a guide, reviewers drift apart in a month.
  • Keep ambiguous rows, but flag them. A tag like ambiguous lets you exclude them from gates while still watching them.

If you grade with a model, the golden set also becomes your calibration material; the LLM-as-judge guide explains how to measure judge agreement against exactly these human labels.

Splits: dev, holdout, and the contamination trap

Prompt tuning is training, even without gradients. If you iterate on the same rows you report, your score creeps up and your production quality does not.

Split the set in two. A dev set is what engineers look at, argue about, and tune against. A holdout set is run rarely, by a gate or a weekly job, and its failing rows are not pasted into prompts as few-shot examples. When the holdout stops tracking the dev score, you have started overfitting.

Also watch for leakage in the other direction: golden rows copied verbatim into few-shot examples, system prompts, or fine-tuning data. If an example is in the prompt, it is no longer a test. Scan prompt files against dataset inputs as part of CI.

Size: how many rows is enough

There is no magic number, but there are useful ranges. Thirty to fifty well-chosen rows will catch glaring regressions. A few hundred supports per-tag reporting. Beyond that, extra rows only help if they add new failure modes rather than more copies of easy ones.

Statistical noise matters when you compare. With 100 rows, one flipped answer moves accuracy a full point, so a “two-point improvement” may be two answers. Report the count of rows that changed state (passed to failed, failed to passed) alongside the percentage; a diff of specific rows is more informative than a delta.

Versioning so scores stay comparable

A score is meaningful only relative to the dataset version that produced it. Treat the dataset like a package:

  • Store it in git as JSONL (diffable, reviewable in pull requests), or in object storage with a content hash recorded in the repo.
  • Use semantic-style versions. Adding rows is a minor bump; changing a label or removing rows is a major bump, because historical scores no longer compare.
  • Keep a changelog entry per change: why the row was added, which incident it came from, who approved it.
  • Stamp every eval run with the dataset version and hash, plus the prompt version and model identifier.
  • When the set changes materially, rerun the previous baseline on the new version before comparing candidates.

Without these, you will eventually look at a chart where scores jump on the day somebody “cleaned up” the dataset, and nobody can tell whether the system improved.

Keeping the set alive

A golden set decays. Products change, documents are rewritten, and last year’s correct answer is now wrong. Schedule a light review every month or after any major content change; the agent knowledge freshness article covers detecting stale sources that quietly invalidate expected answers.

Make incident response feed the dataset. The rule that pays off most: no production failure is closed until it has a row. A failure you fixed without capturing will come back with the next prompt rewrite, and you will meet it in production again.

Rotate some rows out. Easy rows that every version has passed for six months can move to a smoke set that runs quickly, freeing the main set for hard cases.

Where the dataset plugs in

Once rows exist, they feed tools. DeepEval turns them into test cases that run under pytest (see our DeepEval guide), promptfoo reads them from CSV or JSONL as test variables (see the promptfoo evaluation guide), and RAGAS expects a similar question, context, and reference shape for RAG scoring. The point of those tools is to run the dataset on every change, and the point of a regression gate is to make the result binding. The LLMOps production guide shows where dataset ownership sits among the other operational responsibilities, and the agent harness overview explains how agent systems consume this kind of evidence about their own behavior.

A practical first-month plan

  • Week 1: collect 40 rows from traces and tickets, write the labeling guide, tag by failure mode.
  • Week 2: second-reviewer pass on a sample, fix ambiguous rows, split dev and holdout.
  • Week 3: run the first baseline, record dataset hash and prompt version, and read every failing row.
  • Week 4: add the rule that every incident gets a row, and schedule the monthly review.

Forty trustworthy rows beat four hundred scraped ones. Start there, add what hurts, and version it like the production asset it is.

Golden dataset questions, answered

What is a golden dataset for LLM apps?
It is a curated set of inputs with human-reviewed expected behavior, used to measure prompts, retrievers, and agents consistently over time. The expected behavior can be a reference answer, a list of required and forbidden facts, or an expected tool call.

How many examples should a golden dataset have?
Thirty to fifty carefully chosen rows can catch obvious regressions, and a few hundred lets you report by failure-mode tag. More rows help only when they add new scenarios, not repeated easy ones.

Can I generate a golden dataset with an LLM?
You can use a model to draft or paraphrase rows, but a human should review the labels, and synthetic rows should be tagged and capped so they do not dominate. Real production queries and expert-written edge cases are more valuable per row.

How do I stop overfitting my prompts to the eval set?
Split the data into a dev set you tune against and a holdout you run rarely. Keep dataset rows out of few-shot examples and system prompts, and treat a widening gap between dev and holdout scores as the warning sign.

How should I version a golden dataset?
Store it as JSONL in git or hashed in object storage, bump a major version when labels change or rows are removed, and stamp every eval run with the dataset version. That keeps scores comparable across weeks.

When should a failing production case become a golden row?
Right away, as part of closing the incident. Capture the input, the correct behavior, and a failure-mode tag, so the next prompt or index change is tested against the mistake you already made once.

Related reading

About Mudasir Syed

Check Also

Rows of server racks in a data center suggesting storage infrastructure for vector database workloads

Open-Source Vector DB Projects Worth Tracking

Choosing among open source vector database projects is less about finding the fastest one and …

Leave a Reply