A golden dataset is a version-controlled set of representative inputs with known-good outputs or acceptance criteria. Running it on every change catches anything that degrades known behavior.

Seeding a golden dataset from traffic and bugs

Golden datasets & regression testingDiagram with these labels, in reading order: Seed from; real traffic; Create; Golden Dataset; Run Tests; against Dataset; Check Outputs; against Expectations; Flag/Block; if Failure.Seed fromreal trafficCreateGolden DatasetRun Testsagainst DatasetCheck Outputsagainst ExpectationsFlag/Blockif Failure
Golden Datasets in Regression Testing

Collect data from real user interactions, including edge cases and bugs that caused trouble in the past. Pair each input with a known-good expected output or acceptance criteria. Version-control the set like code, so you can see when a case was added and why. Write down what a pass means for each case before you run the set.

  1. Seed the dataset from real traffic and historical bugs.
  2. Run the system against the set whenever you change the model, prompts or RAG process.
  3. Check outputs against the expectations.
  4. Flag or block the change when results deviate.

Automate the run in a CI pipeline, so no change reaches production without passing it. Take a customer-support chatbot as an example: you gather successful interactions and their expected responses. When the underlying model changes, you run the set, and a failed golden case halts the deployment until you fix it.

Grading against criteria instead of exact strings

The set resembles a regression suite combined with snapshot tests. In traditional tests a snapshot is compared to saved output. Here the expected output is often a set of criteria or must-include facts. Grading needs judges or assertions, and a simple equality check does not fit.

Growing the set after each incident

The set changes over time. After each production incident, decide whether it should become a golden case. Cases added this way mean the same issue cannot return without detection.

Without a fixed set, a change meant to fix one case may break several others, and you learn about it when users complain. With one, regressions show up before release. Online evaluations complement the set by surfacing unknown cases that may need to join it.

A static set goes stale A golden dataset that never changes misses new edge cases. Keep updating it.

Example scenario: 30% of golden cases fail after an update

Suppose 30% of golden cases fail after an update. A change in the underlying model or a preprocessing step may have altered how inputs are interpreted. Discrepancies can also appear when the data pipeline or model changes without a matching update to the dataset.

Golden datasets & regression testingDiagram with these labels, in reading order: failure check; check new inputs; if outdated; if bug found; if new input; if bug detected; Regression Test Failure; Rate; Outdated Golden Dataset; New Input Variations; Bug in Recent Update; Update Golden Dataset; Fix Code Bugs.failure checkcheck new inputsif outdatedif bug foundif new inputif bug detectedRegression Test FailureRateOutdated Golden DatasetNew Input VariationsBug in Recent UpdateUpdate Golden DatasetFix Code Bugs
Debugging golden dataset failures
  1. Review deployment logs for changes to the model or preprocessing code.
  2. Compare inputs and outputs of the failing cases with the previous version.
  3. Check for dependency or library updates that affect data handling or model behavior.

The fix is to revert to the last known good version, and update the dataset if the expectation itself is outdated. This may delay new features. Monitor output accuracy against the golden set across later deployments.

Back to the knowledge baseRequest an assessment