Run each test case through the full setup: prompt, product context, model and tools. Score the results against your team’s definition of a good answer. Include typical inputs, difficult edge cases and adversarial inputs the feature might encounter in production. Keep the dataset fixed across runs and update it deliberately as the feature changes.
Golden dataset vs. ground truth, test set and benchmark
The terms overlap, and teams often use them interchangeably. They describe different things:
- Ground truth is the correct answer for a single input. A golden dataset can pair each input with its ground truth, but it doesn't have to.
- A test set in classic machine learning is a held-out slice of labeled data, often thousands of rows, used to measure model accuracy. A golden dataset is smaller, hand-curated and re-run after every change.
- A public benchmark is a fixed set of test inputs and expected outputs for generic tasks such as writing code, solving maths problems or answering trivia questions. Someone else chose the tasks, and the benchmark measures models in general. A golden dataset measures your AI feature on your own task, your own data and your own definition of a good answer.
Put simply, the golden dataset is the exam you put your AI through again and again. Ground truth, when you have it, is the answer key.
Why a golden dataset matters for AI evaluation
LLM outputs are probabilistic, and a change that fixes one problem can break another without anyone noticing. Without a fixed reference, teams compare impressions: someone tries a few inputs, the answers look better, and the change ships. A golden dataset turns that impression into a number.
It serves three purposes:
- Regression testing. After every prompt or model change, the full set runs again. If quality on a group of cases drops, you see it before users do.
- Comparing options. Two prompts, two models or two architectures run on the same cases, so the comparison is fair and repeatable.
- Validating automated evals. Deterministic checks and LLM judges need human-scored examples to prove they agree with your experts. The golden dataset provides those cases.
Because the exam stays the same, the difference between two runs shows exactly what a change did.
With or without expected outputs
A golden dataset comes in two forms, and both are useful.
Test cases only. A collection of inputs that covers the variety your AI feature will meet in production. You check quality with rules that look at the output itself: deterministic evals such as "is the output valid JSON?" and LLM judges such as "does the reasoning follow our qualification rules?". This is enough to build your first evals, benchmark models against each other and catch regressions.
Test cases with expected outputs. Each input is paired with an approved answer. This adds a second kind of check: comparing the AI's answer to the expected one, for example "is the priority tier the same as in the expected output?".
Teams that come from classic machine learning often already have annotated data from training and evaluating earlier models, so they can add expected outputs from the start. Product teams starting with LLM features usually don't have them, and they shouldn't be expected to write them up front.
A faster way to create them: run your real setup across a wide range of models, and let a product or domain expert pick the answer that comes closest to the ideal one. The expert edits what is still wrong and saves it as the expected output. From then on, every new answer for that test case is compared with it. The ground truth article shows this flow step by step.
How to build a golden dataset
The steps below work for chatbots, extraction pipelines, classifiers and AI agents.
- Collect real inputs. Production traces are the best source: real user questions, documents and conversations. Before launch, use realistic examples from the domain, or generate synthetic data with an LLM and have an expert review it. Synthetic inputs help to cover rare cases, but they should never make up the whole set.
- Cover the variety. Include the common cases, plus edge cases, ambiguous inputs, adversarial inputs and inputs that caused failures before. A dataset of easy cases scores close to 100% and tells you nothing.
- Run the cases on your real setup. Same prompt, same context, same tools your feature uses. Reading the real answers shows which quality dimensions to measure.
- Add expected outputs where they help. For tasks with a clear right answer, such as a classification or an extraction, an expert approves the expected output for each case. For open-ended tasks, rules and judges may be enough.
- Set one standard and keep it. Experts can disagree on the same case, so decide whose standard the AI is measured against. If one person sets the standard, keep that person's standard for every case. If a panel of experts sets it, every expert on the panel reviews every case, and the way you combine their answers (an average, a majority vote or another method) stays the same. Never switch experts between iterations, and never score one case by one person's standard and another case by someone else's. If the standard moves, the scores move with it, and you can no longer tell whether the AI got better.
- Add metadata. Tag each case with its scenario type (happy path, edge case or adversarial), its source (production or synthetic) and other useful descriptors, such as industry, language or customer segment. Tags let you drill into the results and see whether a specific group of scenarios is still hard for your AI.
- Version it. Treat the dataset like code. Each change gets a version number, so runs stay comparable over time.
In Lovelaice, you build golden datasets directly from your experiments. Once an expert has reviewed an answer, it can be saved as the expected output for that test case.
How large should a golden dataset be?
You can start with 20 cases, or even fewer. A small set that covers the main types of input is enough to run your first evals and compare models. The set then grows through the feedback loop described below, usually to 50 to 200 cases as the feature matures.
Go broad before you go big. Twenty cases that each cover a different scenario teach you more than 500 rows of similar, easy inputs. Grow the set when you add a new use case, a new customer segment or a new failure mode, and keep each addition reviewed.
Keeping a golden dataset up to date
A golden dataset grows with the product through a feedback loop:
- Before launch, the set reflects your best guess of what users will send.
- After launch, production shows what users actually send and where the AI struggles. Those cases join the next version of the set, so it stays representative of real use.
- Cases the AI already handles well stay in. They are your regression guards. When you change the prompt, the model or the tools, they show whether something that used to work has broken.
Review the set on a fixed cadence, for example once per quarter, and whenever policies, products or user behavior change. Outdated expected outputs are worse than none, because they reward the AI for giving answers that are no longer correct.
Privacy needs attention too. Production data often contains personal information. Remove or replace names, email addresses and account numbers before a case enters the set, and restrict access to the dataset like any other sensitive data.
An example
A team is building an AI sales assistant for B2B SaaS companies. It reads an incoming lead and assigns a priority tier from 1 to 4 for a specific product. Each test case in its golden dataset has two parts:
- The lead: a person, the company they work at and what they sent, such as a demo request, a newsletter sign-up or an empty form.
- The product context: the product the lead is being prioritized for, with its ideal customer profile, buyer personas and existing customers.
The team varies both parts. On the lead side: a buyer at a target-segment company, a working student at the same company, an employee of the seller's own company, a competitor, a contact from an existing customer and a lead with almost no information. On the product side: three different products with different ideal customers, so the same person can be tier 1 for one product and tier 4 for another. Each case is tagged with its scenario type and its source.
The team can use this golden dataset in two ways:
- Test cases only. Quality is checked with rules: valid JSON, all required fields filled in, a priority between 1 and 4, sources listed, and an LLM judge that checks whether the tier and the reasoning follow the team's qualification rules.
- Test cases with expected outputs. For each case, the product manager approves a full assessment with the right priority and reasoning. A deterministic check then confirms whether the AI's tier matches the expected one, and the judge compares the reasoning.
Suppose a new prompt raises the average score but starts giving existing customers a low priority. Because the cases are tagged, the results for the "existing customer" group show the drop immediately, and the team fixes the rule before release. Without the golden dataset, the improvement would ship together with the new error.
