Blog

How to build a golden dataset for LLM evals from production traces

Turn logged LLM calls into a versioned golden dataset: two teacher models, human review of disagreements, no leakage into training, then a baseline.

4 min read

  • Datasets
  • Evaluation
  • Human review

A golden dataset is a set of cases whose answers people have checked. Every prompt and model change is scored on it. If the set is wrong, every decision made on it is wrong too.

The best source of cases is the traffic you already serve. Hand-written examples test what you imagined users would send. Production traces test what they actually send. This post walks from logged calls to a versioned set that a release gate can use, following the golden dataset guide.

Start from the calls you already log

Read logged calls into a dataset file. With Langfuse:

Terminal
modelstill ingest langfuse --from 2026-11-01T00:00:00Z --name <observation-name> --out data/records.jsonl

The same works for Braintrust, OpenTelemetry GenAI spans, LiteLLM spend logs and any JSONL. Rows with the same input are merged, and each row keeps its source ids, so you can always find the original trace. See Import traces.

Pick a sample that looks like your traffic, not only the cases that went wrong. A set made only of past failures tells you about past failures.

Let two teachers answer, and look where they disagree

Labelling every case by hand is slow. Labelling every case with one model copies that model's mistakes into your answers. A middle path: ask two teacher models from different families to answer every input, and send only their disagreements to a person.

label.py
from pathlib import Path

from modelstill.data import DatasetStore, label

store = DatasetStore(Path("data/records.jsonl"))
report = label(store.load(), {"teacher-a": ask_a, "teacher-b": ask_b}, same_answer)
store.save(report.items)
print(report.agreed, report.disagreed, report.failed)
  • Each teacher is your own function from input to answer. same_answer decides when two answers count as the same, for example after parsing JSON.
  • Every answer on the item is compared, including the one recorded from production.
  • An item already accepted or corrected by a person is never asked again.

Agreement is not proof. Two models can agree on the same wrong answer. But disagreement is a cheap, reliable pointer to the cases that need a human, and it keeps the review queue short enough to finish.

Send disagreements to people

Terminal
modelstill push review data/records.jsonl --task <task>

Items whose answers differ go to the review queue. Items whose answers agree are stored as not needing review. A human decision is never overwritten by a later push.

A reviewer sees the answers side by side and has two ways to settle an item:

  • Correctstores the answer they write as the item's final answer.
  • Accept marks the item as decided, but does not record which answer was right.

Only Correct stores an answer. Use it for every item you want in the golden set.

Make it a versioned dataset

Create a dataset on the Datasets page and add the corrected items. Read them with GET /v1/tasks/{slug}/dataset-items?state=corrected, then import them, mapping input to Input, finalOutput to Expected and inputHash to Case id. There is no button that copies labelled items into a case dataset yet.

Every change writes a new version and old versions stay readable. When a reviewer finds a mistake, edit the case and the change is recorded in that row's history.

Export the set as benchmark JSONL and commit it next to the task spec. The file has the same version hash as in the dashboard, and a pull request that changes the set is reviewed like code. See Benchmarks, datasets and history.

Keep it out of training

If you also train a model on the same traces, the golden cases must stay out of the training split. Otherwise the student is graded on questions it has already seen, and the score means little.

split.py
from modelstill.data import split

parts = split(store.load(), {"train": 0.9, "val": 0.1}, seed="v1", exclude=golden_ids)

exclude matches input hashes and source ids. If an excluded item lands in train, split raises LeakageError rather than carrying on. Using inputHash as the case id makes the golden ids easy to pass.

Accept a baseline

Score the model you run today on the set, record the run, and accept it:

Terminal
modelstill eval runs history.jsonl
modelstill eval accept history.jsonl <run>

From then on, each candidate runs on the same set and is compared with the baseline case by case. Runs are only compared when they ran on the same version of the set. When you add cases, record and accept a new baseline on the new version.

That baseline is what the release gate holds every change to. What an LLM eval framework should decide covers what the gate checks, and the judge post uses the same human labels to check an LLM judge.

See a release gate pass and fail in three commands.

Get started