← All posts

Dataset engineering for model training: where to start

A pillar guide to data for training and evaluating AI: golden records, golden editors, train/eval splits, leakage, manifests, and parameters by task and domain.

Dataset engineering for model training: where to start
Contents

The team spends two weeks tuning checkpoints and learning rates. The dataset is a folder of four hundred ChatGPT exports with no schema, no owner, and no answer to “what counts as correct in our domain.” The demo sounds convincing. In the pilot, legal finds a fabricated policy reference, an operator gets a confident answer from a revoked instruction, and nobody can reproduce the “12% improvement” — because the eval set was edited in the same sprint as the prompt.

That is a typical failure of data engineering, not architecture. In enterprise and industrial AI, a dataset is not a notebook appendix but a versioned product: input/output contract, owner, manifest, golden editors, and a regression gate before release.

Below is the pillar article for a series on preparing datasets for training and evaluation: golden records and editors, four data families, lifecycle from production back into the set, train/eval leakage, and parameters by task and domain. It complements but does not duplicate golden datasets for RAG eval, RAG data preparation, and production RAG engineering.

Key takeaways

A dataset is a versioned product — schema, owner, manifest (hash + version + labeling rules), and change history in git or a data store.

Training and evaluation are separate loops. Training corpora teach behavior; golden sets measure it. Mixing them without leakage audits produces fake metrics.

Task contract before volume and model. Inputs, outputs, and refusals are defined before LoRA and checkpoint size.

A golden record is a per-example contract: input, expected output or acceptance criteria, metadata. A collection is a golden dataset.

Golden editors are domain experts who create and adjudicate gold. Without them, synthetic data yields pretty scores and weak production behavior.

Parameters depend on task and domain: volume, label unit, hard negatives, and quality gates differ for classification, SFT, retrieval, and CV.

The loop does not end at release: production failures enter a mining buffer, pass editor review, then join gold or training.

Averages lie without slices. A good mean can hide failure on a rare, expensive segment — obsolete policy, wrong tenant, poor scan quality.

How dataset engineering differs from “we exported a CSV”

Dataset engineering is not a one-off log dump or a labeling marketplace order. It is a repeatable process with explicit artifacts:

Artifact What it fixes Without it
Schema Fields, types, required columns Every file its own format
Rubric Correct / refuse / escalate rules Endless review arguments
Manifest Version, hash, changelog Incomparable metrics
Owner Who approves gold and train Labeling “whoever was free”
Eval harness Runs pinned to dataset version Manual chat checks
Regression gate Slice thresholds before ship “Better on average”

If you lack schema, golden owner, and versioning — you are prompt-experimenting, not doing data engineering yet. Fine for day zero; risky once the pilot is promised to the business.

Why data beats the next model

Error cost is asymmetric. A wrong demo label is annoying. A wrong reading of a safety regulation is an incident. So “which model?” comes after “what contract can we verify on production-like data?”

Three signals to fix the dataset first

  1. Metrics jump without reproducibility — prompt, set, and model changed in one PR.
  2. Great offline scores, bad pilot — domain gap (see MNIST vs field forms in handwritten digit OCR).
  3. No labeling owner — “correct” is whoever looked at the chat last.

Cost of bad data

  • Overfitting to eval — metrics cheer until a novel query arrives.
  • Expensive fine-tuning — GPU hours on noise instead of fixing retrieval or rubric.
  • Nameless regressions — cannot roll back “dataset v3” because there was no version.
  • Domain trust loss — experts stop reviewing if their edits are ignored.

Dataset engineering makes improvements explainable: dataset version, slice, gate — artifacts both engineers and product owners understand.

Task contract: input, output, refusal

Before labeling, freeze the contract:

Element Question Example
Input What does the model see? Question + retrieved chunks + language
Output Response format? Markdown + clause link; JSON schema
Refusal When not to answer? No source; ACL deny; obsolete version
Escalation When to a human? High risk class; low confidence
Language ru / en / mixed? Answer in question language
Source of truth What counts as fact? ERP, DMS — not chat

The contract is the basis of the golden editor rubric. Without it, low inter-annotator agreement is a process failure, not “hard task.”

Broader eval mindset: evaluating LLMs before production. Here we focus on data feeding that eval.

Four data families

Up to four families coexist; confusing them causes leakage and false releases.

Family Purpose Typical use Risk if mixed
Training corpus Teach patterns SFT, classifier fine-tuning, query–chunk pairs Overfit to eval, memorizing goldens
Preference data Teach ranking DPO, RLHF pairs Style without facts
Golden / eval set Measure behavior Regression, CI, version compare Prompt tuning to visible cases
Mining buffer Raw prod failures Editor review queue Scoring unlabeled cases

Training corpus

Teaches how to respond: tone, format, domain patterns. Can be larger and noisier at the edges — but needs lint: dedup, ACL scan, no obvious eval overlap.

Preference data

When you need preference between two plausible answers: shorter vs fuller, formal vs casual, with citation vs without. Smaller than SFT; annotator quality matters more.

Golden set

Fixed, versioned, often smaller than train. Each golden record is a reference for comparison. RAG-eval measures retrieval + generation; classification — slice accuracy; extraction — field F1.

RAG-specific eval: golden dataset for RAG eval.

Mining buffer

Raw stream: logs, complaints, “model was wrong.” Not reporting metrics until an editor promotes a row to gold or train. SLA by risk class: safety incidents — hours; cosmetic — weeks.

Golden record: minimal schema

In DeepEval / Confident AI, a golden is a precursor to a test case: fixed fields before the run; at eval you add actual_output, retrieval context, tool calls.

Minimal contract in your repo (JSONL in git):

{
  "id": "reg-2026-0142",
  "input": "What is the validity period of the work-at-height instruction?",
  "expected_output": "Answer citing active revision I-OT-12 dated 2024-03-01; if only revoked text exists — refuse and name the version.",
  "acceptance": "citation_required",
  "metadata": {
    "domain": "industrial_safety",
    "risk_class": "high",
    "language": "en",
    "source_ids": ["I-OT-12"],
    "tags": ["height_work", "validity"]
  },
  "annotator": "editor:petrov",
  "rubric_version": "ot-rubric-1.2",
  "dataset_version": "golden-regulations-v3"
}

acceptance and rubric_version tie the row to editor rules. Without them, nobody explains why “correct” changed six months later.

Golden editors: a role, not just a UI

Golden editor comes from LLM eval UIs; in industry the role matters:

Responsibility Why
Write/update rubric Shared correct / refuse / cite rules
Label rare, high-risk cases They break prod
Adjudication Two annotators disagree → third expert + manifest note
Reject bad synthetic Paraphrase without fact does not enter gold
Prioritize mining buffer Risk over volume

Engineering owns schema, validation, CI; golden editors own what “gold” means. Otherwise: dataset theater.

Record states (like Confident AI queue vs push):

State Who sees it In eval?
Draft in buffer Editors No
In review Editor + reviewer No
Finalized golden Team Yes
Holdout Limited circle Yes, rarely, no prompt iteration on it

Workflow deep-dive: golden-editors-annotation-workflow-2026.

Lifecycle: from production back into the set

flowchart TB
  subgraph sources [Sources]
    prod[Traffic and logs]
    docs[Documents and policies]
    synth[Synthetic by rubric]
  end

  subgraph human [People]
    editors[Golden editors]
    adjud[Dispute resolution]
  end

  subgraph artifacts [Artifacts]
    buffer[Mining buffer]
    golden[Golden dataset vN]
    train[Training corpus]
    pref[Preference pairs]
  end

  subgraph gates [Control]
    eval[Eval harness]
    ci[Regression gate]
  end

  prod --> buffer
  docs --> train
  synth --> train
  buffer --> editors
  editors --> adjud
  adjud --> golden
  adjud --> train
  train --> eval
  golden --> eval
  eval --> ci
  ci -->|pass| release[Model / prompt release]
  prod -->|new failure| buffer

Rules:

  • Buffer ≠ golden — no rubric and review → not in reporting.
  • Pin version to every run — log dataset_version, model_version, prompt_version.
  • Holdout closed during prompt iteration.
  • One big variable per experiment — do not change parser, prompt, and dataset in one release.

Train, eval, and holdout

flowchart LR
  subgraph pools [Data pools]
    train[Train / SFT]
    dev[Dev eval — visible]
    hold[Holdout — hidden]
    mine[Mining buffer]
  end

  train -->|training| model[Model / prompt]
  dev -->|iterations| model
  dev -->|CI metrics| gate[Gate]
  hold -->|rare check| gate
  mine -->|after editors| dev
  mine -->|after editors| hold
Pool Who uses it When to trust metrics
Train Training, augmentation Not as final proof
Dev eval Dev team Every PR / nightly
Holdout Tech lead / governance Major release
Mining buffer Editors Not for metrics

Leakage: paraphrases in train and eval; few-shot from goldens; fine-tune on text near eval. Run near-duplicate search between pools. Article: dataset-splits-leakage-2026.

When train is needed vs RAG and prompt alone

Situation Often enough Train / SFT when
Facts in docs, varied phrasing RAG + prompt Response style, strict JSON
Classification on large logs Baseline + features Complex language, many classes
Narrow domain, little data Prompt + golden eval Thousands of expert-labeled pairs
“Brand voice” System prompt Thousands of pairs + preference

When fine-tuning is justified: when fine-tuning is needed.

Parameters by task type

Task type Label unit Rough volume First priority
Classification / extraction class, span, JSON 1k–50k balance, confusable pairs
Instruction tuning / SFT instruction → output 500–10k template, language, refusals
Retrieval / ranking query–document thousands of pairs hard negatives, ACL, version
Grounded generation question + reference + source hundreds–thousands citation, “I don’t know”
Computer vision / OCR image, bbox, sequence 5k–500k capture conditions, domain gap
Preference / DPO A/B pair 2k–20k inter-rater agreement

Hard negatives

Critical for retrieval and classification: “similar but wrong.” Without them, models fail on adjacent policy sections or look-alike SKUs.

Refusals and out-of-scope

Expected refusals are required, not labeling errors. For a policy assistant, 15–25% goldens with refuse/escalate is reasonable.

Parameters by domain (short matrix)

Full article: dataset-parameters-by-domain-2026.

Domain Data peculiarity Golden editor Typical failure
Industrial / safety Policy versions, high error cost Safety engineer Answer from revoked doc
Finance / compliance No advice without disclaimer Compliance + legal Confident answer without source
Code / repos API versions, file context Senior dev Stale snippet
Documents / OCR Scan, table, footer Operator + QA MNIST thinking
Customer support Tone, escalation Supervisor Overfit to templates

Team and ownership

Role Responsibility
Product owner Slice priorities, risk class
Golden set owner Golden versions, holdout
Golden editor Rubric, labeling, adjudication
ML / platform engineer Schema, harness, CI, manifest
Security / compliance ACL in metadata, train leakage

Write RACI: who approves buffer → golden, who can change rubric without a major dataset version.

Versioning and manifest

Attach a manifest to every eval release:

dataset_id: golden-regulations
version: v3.2.0
schema_version: 2
rubric_version: ot-rubric-1.2
content_hash: sha256:...
record_count: 142
holdout_count: 28
created_at: 2026-08-15
changelog: "Added 12 obsolete-edition cases; fixed reg-0088"

CI: schema validation, unique id, no empty expected_output without acceptance: refusal, holdout not in train. Governance article: dataset-versioning-governance-2026.

Dataset quality metrics (not only model accuracy)

Dataset metric What it shows
Intent / class coverage Holes in slices
Refusal share Not teaching “always answer”
Slice stability across N→N+1 Data regression, not model
Annotator κ Rubric quality
Record age Stale goldens
Prod vs synthetic share Realistic distribution

Organizational AI metrics: evaluating enterprise AI. Here: quality of the set artifact.

Enterprise example: policy assistant

Industrial group shipping an internal policy assistant.

Week 0 — contract. Product and safety fix: cite-only answers; version conflicts → refuse; out-of-scope → refuse with route to HR/IT.

Weeks 1–2 — golden v0 (80 rows). Golden editors (two safety engineers + methodologist) label by rubric. Dev eval for the team only. Holdout 20 rows — separate file, tech lead access.

Weeks 3–4 — baseline RAG. Index per RAG data preparation. Eval on golden v0: “obsolete version” slice — 40% failures. Conclusion: index lacks valid_to and prompt lacks refusals — not “wrong model.”

Weeks 5–8 — SFT corpus (600 pairs). Only after retrieval fix. “Question → cited answer” pairs, not raw chunks. Train disjoint from holdout (embedding dedup check).

Ongoing — buffer. Two finalized goldens per week from pilot. Quarterly rubric review and major dataset version.

After a quarter: reproducible report tying golden v1.3, index manifest, and model to slice improvements.

Industrial example: field forms and OCR

Handwritten digit OCR shows environment-driven parameters: not 28×28 glyphs but perspective photos; not one digit but a sequence; labels from DB; different problem statements → different metrics and architectures.

Same law for LLMs: channel, noise, and problem statement in the dataset beat checkpoint size.

Question Where to go deeper
RAG eval in prod rag-golden-dataset-eval-2026
PDF/OCR ingestion rag-document-ingestion-2026
Full RAG chain production-rag-engineering-2026
Need fine-tuning? when-fine-tuning-is-needed
Enterprise metrics evaluating-enterprise-ai

This series does not replace the RAG cluster; it covers training, labeling, golden editors, and data governance where indexing alone is not enough.

Common mistakes

One file for train and test — audit duplicates and paraphrases, not only random_split.

Goldens without versioning — last month’s metrics are incomparable.

Synthetic instead of experts on rare cases — LLMs multiply plausible noise.

No refusals in gold — model learns to guess.

Empty metadata — invisible regressions by tenant, language, risk.

Fine-tune before fixing retrieval — SFT memorizes search errors.

Labeling without rubric — endless disputes, low κ.

What to try today

  1. Sketch four families and where data lives today.
  2. Assign a golden set owner and freeze one golden record (JSON above).
  3. Run leakage search between train/dev and reporting eval.
  4. Add five expected-refusal cases before the next model swap.
  5. Write manifest v0.1.0 even for 30 rows — version habit from day one.

FAQ

How is a training golden set different from an eval golden set?

Eval goldens are fixed and versioned — you measure, not train (unless explicit and leak-safe). Training corpora change more often and can be larger/noisier. Same JSONL shape, different access policies and gates.

How many golden records to start?

For a CI regression gate, 50–150 well-stratified cases often suffice; holdout another 20–50 the team does not eyeball-tune to. Eighty adjudicated beats eight hundred synthetic without an editor.

Can LLMs label goldens?

As draft and queue acceleration — yes. As sole editor for high-risk domains — no. Finalized gold passes human rubric; LLM-as-judge is a separate calibrated contour.

Separate datasets for RAG and SFT?

Often yes. RAG-eval tests retrieval + generation on corpus questions. SFT corpus teaches wording and format. Text overlap is a leakage candidate — run dedup.

Is git enough for datasets?

For hundreds to a few thousand text rows in JSONL — yes: diff, PR review, version tags. Large media → object storage + manifest in git. Do not edit goldens in place without a version bump.

Next in the series

  • Golden records and golden editorsgolden-editors-annotation-workflow-2026
  • Train / eval / holdout and leakagedataset-splits-leakage-2026
  • SFT and preference datasft-dataset-design-2026, preference-dataset-rlhf-2026
  • Parameters by domaindataset-parameters-by-domain-2026

Series catalog: docs/ml-datasets/README.md in the project repo.