What actually happens during supervised fine-tuning? What role do chat templates and special tokens play?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
SFT is just continued next-token prediction (cross-entropy loss) on curated (prompt, response) examples - same objective as pretraining, different data. What makes it "instruction tuning" is that examples are rendered through a chat template: the exact special-token markup separating roles and turns that the model's original post-training used, e.g. ChatML-style <|im_start|>user ... <|im_end|> or Llama-style headers.
Full worked answer
SFT is just continued next-token prediction (cross-entropy loss) on curated (prompt, response) examples - same objective as pretraining, different data. What makes it "instruction tuning" is that examples are rendered through a chat template: the exact special-token markup separating roles and turns that the model's original post-training used, e.g. ChatML-style <|im_start|>user ... <|im_end|> or Llama-style headers.
messages = [
{"role": "system", "content": "You are a support agent."},
{"role": "user", "content": "Reset my password"},
{"role": "assistant", "content": "Sure - here's how..."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False)
Why it matters: those special tokens are load-bearing. The model learned that <|im_end|> (or an EOS/EOT token) means "stop generating," and that content after the assistant header is its own voice. Two classic failure modes:
- Template mismatch - training with one template and serving with another (or with a raw string). The model rambles, ignores the system prompt, or never emits EOS. This is the most common silent bug in fine-tuning.
- EOS handling - forgetting to append the end-of-turn token to training targets, producing a model that can't stop; or letting the tokenizer split special tokens into pieces instead of mapping them to their reserved IDs.
If you add new special tokens (e.g. tool-call delimiters), you must resize embeddings and expect to train them - freshly initialized rows are random, which is one reason to prefer the model's existing reserved tokens.
Strong candidates mention that the base-vs-instruct choice matters: fine-tuning an instruct model means conforming to its existing template; fine-tuning a base model means you define the template but must teach all chat behaviour yourself.
What a good answer covers
- SFT is just continued next-token prediction (cross-entropy loss) on curated (prompt, response) examples…
- What makes it "instruction tuning" is that examples are rendered through a chat template
- ChatML-style <|im_start|>user ..
- Why it matters: those special tokens are load-bearing
- The model learned that <|im_end|> (or an EOS/EOT token) means "stop generating," and that content after…
Key terms: chat template · Template mismatch · EOS handling
In the glossary: SFT · Cross-entropy · Chat template · Fine-tuning
Interviewer follow-ups to expect
Your fine-tuned model never stops generating - top three suspects?
Why can training a base vs. an instruct checkpoint give different results on the same data?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep