Supervised Fine-Tuning (SFT)
Understand how labeled input-output examples teach a model a target behavior.
The supervised objective
Supervised fine-tuning presents an input, such as an instruction and optional context, alongside a target response written by a human or trusted process. The training objective increases the probability of target tokens in sequence. Over many examples, the model adjusts its parameters toward patterns in the dataset. This does not mean it memorizes a perfect procedure or always follows the target. Results depend on data quality, task clarity, base-model capability, optimization settings, and how closely production inputs resemble training inputs.
Format examples consistently
Choose a single conversation or instruction format that matches the target model and serving tokenizer. Represent roles, context, user input, and assistant output consistently, and avoid accidental formatting differences that teach irrelevant patterns. Keep answers complete enough to demonstrate the behavior but no longer than necessary. Include structured fields when the application expects structured output. Validate every record before training, because one malformed example can create confusing failures that look like model weakness rather than data corruption.
{
"messages": [
{"role": "user", "content": "Classify: refund requested after 45 days"},
{"role": "assistant", "content": "{\"label\":\"policy_review\",\"confidence\":0.91}"}
]
}Labels and target quality
Targets should show the behavior you want in realistic language, including correct refusals, uncertainty, edge-case handling, and formatting. Do not mix incompatible policies or contradictory answers without an explicit reason. If labels come from another model, sample and audit them against human standards; fluent synthetic data can amplify systematic errors. Record provenance, annotator guidance, disagreements, and revisions. A smaller set of carefully reviewed examples is often more valuable than a large set with inconsistent instructions and hidden shortcuts.
Loss and masking
Most instruction-tuning systems calculate loss primarily on assistant or target tokens, while masking prompt tokens so the model is judged on the response it should produce. The exact packing, truncation, weighting, and end-of-sequence behavior vary by training stack. Inspect tokenized samples before launching a run. Confirm that long contexts are not silently removing the answer, that role markers are correct, and that padding or label masks do not create unintended learning signals. Training configuration should be treated as part of the experiment record.
Splits and leakage
Create train, validation, and test splits before experimenting, and keep related or duplicate examples in the same split. Near-duplicate leakage can make validation look excellent while production performance remains poor. If examples contain users, documents, or time periods, split by those meaningful groups when necessary. Keep the test set protected from iterative tuning, and document the split seed and filtering rules. Evaluation is credible only when the model is tested on examples that were not used to shape the run.
Training controls
Set a learning rate, batch strategy, sequence length, number of epochs, checkpoint cadence, and random seed that match the model and dataset size. Watch training and validation loss, but do not optimize loss alone; an overfit model can become less helpful while its training score improves. Save checkpoints and configuration so a run can be reproduced or rolled back. Start with a small pilot to expose formatting, memory, and data issues before spending on a full training job.
Evaluate behavior and regressions
Compare the tuned checkpoint with the base model and prompt baseline on held-out task examples, adversarial inputs, safety cases, and general capability probes. Validate exact schemas and business rules with deterministic checks, then use human review for nuance. Inspect verbosity, refusal behavior, factuality, instruction following, and sensitivity to phrasing. A successful SFT run improves the target without unacceptable regressions. Package the dataset version, training configuration, evaluation results, model hash, and known limitations with the release candidate.