What a target is
Supervised fine-tuning teaches by example: here is a situation, here is the reply we want. In a chat, the situation is the conversation so far and the reply is an assistant message. The replies you mark as worth learning are the targets, also called trainable replies. Everything that comes before a target is its context.
{"messages": [
{"role": "system", "content": "You are Scalata's support assistant."},
{"role": "user", "content": "How do I reset my password?"},
{"role": "assistant", "content": "Open Settings → Security and choose Reset password. You'll get an email link valid for 30 minutes."}
]}The model learns a mapping: given this system prompt and this question, produce this answer. Across hundreds of records it picks up what the answers have in common — the menu-path style, the length, the level of detail, the tone.
How a target is learned
For each target the model reads the context and predicts the reply one token at a time. At every position it gives a probability to every possible next token, and the training error — cross-entropy loss — is low when it gave the token that actually comes next a high probability. The weights are then adjusted so the target's tokens become more likely the next time a similar context appears. Context tokens are read but not scored; see Loss masking.
Two consequences follow. First, the model learns everything about a target: its facts, phrasing, length and errors. Second, it learns each target in its context: a reply that is right after one question may be wrong after a similar-looking one, and the model can only tell the difference if the context shows it.
Choosing good targets
- Correct. Wrong facts, broken steps and outdated menu names are learned as faithfully as good ones.
- The answer you want, not the answer you got. If a reply was nearly right, correct it rather than keeping it as it is.
- Self-contained. A reply that only makes sense because of something the model will not see — an attached file, a shared screen — teaches it to refer to things that are not there.
- Consistent. Similar questions should get similarly shaped answers, or the model learns inconsistency.
- Real answers. Error messages, platform refusals and replies that only announce a generated file are not answers to learn.
- Reply 1: “Hi! How can I help today?” — a greeting. Harmless, but not worth learning; leave it as context.
- Reply 2: “Please check your settings.” — vague. Either correct it to the actual steps, or leave it as context.
- Reply 3: “Open Settings → Notifications and switch off ‘Weekly digest’.” — specific and correct. Mark it as a target.
- Result: one target, with the greeting and the vague reply as context. If you correct reply 2, it can become a second target.
Common mistakes
- Marking every assistant reply as a target by default, greetings and filler included.
- Keeping a nearly-right reply as a target instead of correcting it.
- Including replies that depend on attachments or tool results the model will not have.
- Training on a reply that was later found to be wrong.
References and further reading
External sources open in a new tab.
- 01SFT TrainerHugging Face TRL docs · huggingface.coHow an open-source trainer trains on assistant replies only.
- 02Supervised fine-tuningOpenAI API docs · developers.openai.comA hosted provider's guidance on preparing training examples.
- 03LIMA: Less Is More for AlignmentZhou et al., 2023 · arXiv · arxiv.orgHow far 1,000 carefully chosen targets can go.
- 04Supervised Fine-TuningHugging Face LLM Course · huggingface.coA worked walk-through of supervised fine-tuning on chat data.