Building Golden Datasets

Curate representative, versioned test sets from real usage, edge cases and synthetic data, and keep them fresh.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Why and How to Evaluate LLM Apps

An eval is only as good as its data. A golden dataset is a curated set of inputs, often with reference answers or grading notes, that represents what your system must handle.

Where examples come from

  • Real traffic: sampled production queries (with PII removed) are the most representative source.
  • Domain experts: they know the tricky cases and can write reference answers.
  • Failure logs: every bug report or thumbs-down is a candidate test case, so the set grows with your product.
  • Synthetic generation: a model can draft variations and edge cases, but a human should review them. Synthetic data tends to be cleaner and easier than reality.

Good dataset properties

  • Coverage of intents, user types, languages and difficulty levels, not just the happy path.
  • Adversarial and out-of-scope inputs: questions you should refuse, injection attempts, empty or huge inputs.
  • Clear expectations: an exact answer, a list of required facts, or a rubric per example.
  • Versioning: store datasets in the repo or a dataset tool with a version, so scores are comparable over time.
  • Splits: keep a held-out set you do not tune against, or you will overfit prompts to your tests.

Maintenance

Review the set regularly. Remove duplicates, update answers when policies change, and add new failure categories as they appear.

Good enough to move on

You have a versioned JSONL dataset of at least 50 examples for your app, tagged by category and difficulty, with a documented process for adding production failures to it.

Key concepts

  • Sampling real traffic
  • Expert-written references
  • Synthetic test generation
  • Edge and adversarial cases
  • Tagging by category
  • Versioning and held-out splits

Mini project

Build a 60 example golden set for a RAG app: 30 from real or realistic questions, 15 synthetic edge cases you reviewed, and 15 out-of-scope or adversarial prompts, each with expected facts and a category tag.

Check yourself

Why might a dataset made entirely of model-generated questions give you misleadingly high scores?

Free resources