Data, Training, Validation, and Inference
Data, Training, Validation, and Inference
Key jargon
| Term | Plain-language meaning |
|---|---|
| Training set | Examples used to adjust model parameters. |
| Validation set | Held-out examples used to choose designs and tune settings without training on the final test. |
| Test set | A protected dataset used for the final estimate of performance. |
| Inference | Using a trained model to produce a prediction or generation. |
Key concepts
- Separate data by purpose to reduce self-deception and leakage.
- Training changes model parameters; inference uses the resulting parameters on new inputs.
Concept map
flowchart LR
A["Collect and clean data"] --> B["Train parameters"]
B --> C["Validate choices"]
C --> D["Test then run inference"]Learning objectives
- Explain training, validation, testing, post-training, and inference.
- Recognize leakage, distribution shift, and feedback-loop risk.
Core lifecycle
- Define the task and metric. What input, output, and acceptable error matter?
- Collect and prepare data. Provenance, consent, labeling, balance, and quality shape the result.
- Train. Optimization adjusts parameters to reduce a loss on training examples.
- Validate. A separate split guides choices without becoming the final exam.
- Test. A held-out set estimates performance on the defined distribution.
- Post-train. Instruction tuning, preference optimization, or task adaptation changes behavior.
- Infer. The frozen model computes outputs for new input.
- Monitor. Real use reveals drift and failure cases; changes require a new evaluation.
What can go wrong
- Training examples leak into the test set.
- A benchmark does not resemble the real task.
- Users change behavior after deployment.
- Feedback data rewards confident-looking answers instead of correct ones.
- “Fine-tuning” is proposed when retrieval, prompting, or a deterministic rule would be cheaper.
Exercise
For an email-classification system, propose separate training, validation, test, and post-deployment samples. Explain how you would prevent one conversation thread appearing in multiple splits.
Checklist
- Record dataset source, license, consent, date, and transformation.
- Keep a truly held-out test set.
- Evaluate important subgroups and edge cases.
- Version model, data, prompt, retrieval, and code together.