Writing / Field guide
Why Your Training Data Is the Real Model: Curating Data for Small LMs
Architecture is a commodity; data is the moat. How to find noisy, ambiguous, and memorized examples using the model's own training dynamics, and fix them.
Swap a model architecture and the gain is often marginal. Fix the training data and the gain can be large, especially in narrow domains. For small language models, which have little capacity to waste, data quality is model quality. The hard part is finding the bad examples among hundreds of thousands of good ones.
The trick: your model already knows. Watch how it learns each example over time.
Training dynamics as a data X-ray
Track, per example, the model's probability for the correct label at every epoch. Swayamdipta et al. (2020) summarize each trajectory with two numbers: confidence (the mean across epochs) and variability (the standard deviation). Plot them, and the dataset sorts itself into the three regions they named.
Computing it is cheap
You are already running the forward passes. Log one number per example per epoch.
pythonimport numpy as np
# conf[e, i] = model probability of the gold label for example i at epoch e
def data_map(conf, low=0.3, high_var=0.2):
confidence = conf.mean(axis=0)
variability = conf.std(axis=0)
region = np.where(confidence < low, "hard",
np.where(variability > high_var, "ambiguous", "easy"))
return confidence, variability, region
The cut-offs are tunable, not universal. Pick them by inspecting the scatter plot for your dataset.
The curation loop
What to do with each bucket
| Region | Typical share | Action | Expected effect |
|---|---|---|---|
| Easy-to-learn | Usually the majority | Downsample | Faster training, little accuracy change |
| Ambiguous | A meaningful minority | Keep and augment | Better generalization |
| Hard-to-learn | A small tail | Audit, then fix or upweight | Cleaner signal, fewer memorized errors |
Synthetic data, carefully
When a class is thin, generate examples, but target them:
Generic "generate 1,000 examples of class X" produces repetitive, easy data. Contrastive generation ("same sentence, but it's a refund, not a billing question") produces the hard negatives that actually move the decision boundary.
Make the data map trustworthy
Training dynamics are signals, not ground truth. The reported confidence depends on the model, optimizer, schedule, augmentations, order of examples, and definition of an epoch. A sample that looks hard under one seed may be ordinary under another. For a useful audit, fix the training recipe and record its version; if a decision would remove or relabel a costly example, repeat the run with another seed or inspect the example directly. Never interpret an arbitrary threshold as a universal boundary between “good” and “bad” data.
For a classification task, let p[e, i] be the probability assigned to example i’s recorded gold label after epoch e. The mean confidence summarizes average support, while standard deviation summarizes movement over the observed checkpoints. It is often useful to retain the full trajectory too: two examples can share a mean and variance but differ in whether the model learned and later forgot the example, or never learned it at all. Record checkpoint timing consistently, and avoid mixing pre-training warmup with later epochs without documenting that choice.
The snippet earlier assumes an array of probabilities with shape (epochs, examples) and that every example has a valid gold label. In production code, validate shapes, finite values, class indices, and missing examples before computing statistics. For multilabel tasks, define whether confidence means the target label’s probability or a task-specific score. For language modeling, token-level loss must be aggregated with an explicit policy; a long example should not silently count as many independent examples. Keep example identifiers pseudonymous and restrict access to source text.
Audit with a hypothesis, not a delete button
Create an audit queue stratified by region, class, source, and risk. Sample examples from every region, including easy-to-learn data; duplicates, leakage, and trivial artifacts can become confidently learned. Reviewers should see the input and label but, when feasible, not the model’s region or suggested correction before their first judgment. That reduces anchoring. Capture decisions as structured categories: correct and representative, incorrect label, ambiguous task definition, duplicate, corrupted input, privacy/provenance concern, or rare valid case. Record confidence and reviewer disagreement, then adjudicate policy-sensitive cases.
Do not automatically delete a region or reweight it. Removing hard examples can improve a headline score while erasing the exact cases the system is meant to handle. Downsampling easy examples can change class balance and calibration, so use class-aware sampling and compare against an unchanged-data baseline. Reweighting duplicates can make their repeated pattern matter less, but deduplication must preserve legitimate repeated events and temporal frequency. Maintain a data changelog with counts, reasons, and reviewer approval for each intervention.
Prevent leakage and contamination
Training-dynamics analysis cannot rescue a contaminated evaluation. Split by the entity that can cause leakage: customer, conversation, source document, template, or time. Normalize and inspect near-duplicates across train and test; templated examples with one changed name may otherwise make generalization look stronger than it is. If a source is time-dependent, a chronological holdout can reveal drift that random splitting hides. Document the split rule and freeze it before comparing curation changes.
Check whether labels were derived from fields unavailable at inference time, whether annotators saw future outcomes, and whether generated synthetic examples paraphrase evaluation records. Keep a provenance record for each source and synthetic generation recipe. Do not place sensitive raw identifiers in model-dynamics logs. Apply retention, access, consent, and licensing rules before using data, not after a promising score appears.
Synthetic data as a targeted intervention
Synthetic data should fill a specific, measured gap: a confusion pair, a rare valid pattern, an underrepresented language variety, or a boundary case in the task definition. Write acceptance criteria first. For a billing-versus-refund distinction, generate paired examples differing in the actual intent signal, not superficial names or punctuation. Review a sample for label consistency and diversity, then run duplicate and contamination checks against all splits. Mark synthetic provenance so results can be reported separately.
Generated examples can be fluent and still encode the wrong label, overrepresent a model’s stereotyped phrasing, or teach artifacts such as a fixed phrase associated with a class. Evaluate real and synthetic subsets separately, and compare training with and without the added data under the same recipe. If the gain exists only on synthetic-like tests, do not claim real-world improvement. Use human-authored examples or targeted collection when generation cannot faithfully represent the target population.
Measure whether curation helped
A data change is an intervention. Keep the original dataset and training recipe as the control, then change one curation decision at a time when feasible. Report overall performance, class-level metrics, critical slices, calibration, data volume, training cost, and the audit outcome. Use the same untouched test set and assess uncertainty; if examples are clustered by source or user, account for that dependence. For subjective labels, report reviewer agreement and adjudication policy rather than implying that every gold label is objective.
Watch for trade-offs: removing noise may improve average accuracy but worsen rare-class recall; adding contrastive data may shift confidence; downsampling can change prevalence assumptions; relabeling can hide an unclear task definition. For high-impact uses, require a domain expert to approve changes to the label guide and retain rollback capability for both data and model artifacts. A useful result is not merely “the score went up,” but “which data issue was corrected, which behaviors changed, and which uncertainty remains.”
Exercises for a first curation sprint
- Pick a narrow task and write a label guide with examples of ambiguous cases.
- Freeze an entity-aware train/validation/test split and hash the source records.
- Train the baseline while logging each example’s gold-label probability at fixed checkpoints.
- Plot confidence against variability, color by class, and inspect a random sample from every region.
- Audit flagged examples blind to their map region; categorize the reason and disagreement.
- Make one reversible change, retrain under the same recipe, and compare on the untouched test set and critical slices.
- Publish the data-change log, limitations, and a list of cases still needing human judgment.
This process is deliberately slower than deleting the lowest-confidence records. The point is not to let a chart curate your data; it is to use the chart to spend limited human review time where it is most informative.
Coordinate reviewers and keep labels consistent
Human review is itself a measurement process. Before a curation sprint, train reviewers on the task guide using examples not drawn from the final audit sample. Ask reviewers to label independently before discussion, preserve both original decisions, and adjudicate disagreements with a documented rule. Agreement is not proof of correctness, but disagreement often reveals an underspecified class boundary. When the task guide changes, version it and consider whether earlier examples need review; otherwise the dataset can contain labels from incompatible definitions.
Do not ask a reviewer to “fix” an example if the correct target cannot be established from available context. Mark it ambiguous, request additional context, or define an abstention class if the product supports one. Preserve original labels and edits in an audit trail. If the example contains personally identifying or sensitive material, follow the approved access and retention process and avoid copying it into tickets or general-purpose logs. Data quality work should not create a new privacy exposure.
Monitor data quality after release
Training data curation is not a one-time cleanup. New sources, product changes, and user behavior can alter the input distribution or the meaning of labels. Keep a small, governed sample of recent production cases for periodic review, where collection is permitted. Track input validity, unknown or abstained cases, class prevalence, delayed outcome disagreement, and changes in source provenance. Do not interpret a changing label rate alone as model drift: it may be a real population change, an instrumentation change, or an annotation policy change.
Use the same privacy controls in production review as in training. Aggregate by useful slices only when group sizes are sufficient, and avoid making sensitive attributes available simply because they might explain a score. When a suspected shift appears, first validate that schemas and logging are stable; then compare representative examples and labels. If the label definition has changed, create an explicit version boundary instead of mixing incompatible labels into one metric.
Limitations of training dynamics
Cartography describes how a particular training procedure interacts with a dataset; it does not identify an objectively bad row. The map may shift when model capacity, optimizer, initialization, data order, augmentation, or class imbalance changes. Confidence can be high because the model learned a spurious shortcut, while variability can reflect optimization noise rather than semantic ambiguity. An example that is hard for a small model may be essential for robustness, and one that is easy may anchor a common safety-critical behavior.
For these reasons, use dynamics to prioritize review, not to automate deletion or define fairness. Combine them with provenance, duplicate detection, annotation audits, distribution analysis, and task-specific error review. If compute permits, compare maps across seeds or checkpoints and focus on examples whose behavior is stable enough to merit attention. If compute is constrained, select a stratified sample and state that conclusions are based on one training run. The method helps allocate human attention; it does not replace domain expertise or sound experimental design.
Keep the curation work proportionate
Not every dataset needs a complex dynamics pipeline. For a small, high-quality corpus, direct expert review and clear provenance may be cheaper and more reliable than training multiple runs to create a map. For a very large dataset, begin with a reproducible sample and a simple audit queue before investing in elaborate per-example logging. Estimate storage, training, reviewer time, and privacy review as part of the plan. The method is useful when it makes scarce review capacity more effective; it is not a badge of sophistication.
Set a stopping rule for the curation sprint. Stop when the remaining flagged examples are understood well enough for the intended use, when review cost exceeds the expected value of another intervention, or when the unresolved uncertainty requires a different data source. Record unresolved categories and decide whether the product should abstain, request more context, or exclude that use case. A clear boundary is better than pretending the dataset is complete.
Key takeaways
- For small models, data quality is the main lever.
- Log per-example probability for the gold label across epochs to build a data map.
- Keep ambiguous examples, audit hard-to-learn ones, and downsample easy ones.
- Never auto-delete hard examples. Audit first.
- Generate synthetic data contrastively, targeted at confusion pairs.
Further reading: Swayamdipta et al., Dataset Cartography (EMNLP, 2020). Open-source implementation of the weak-strong idea: TinyMorph.
