Why does completion-only loss usually outperform full-sequence loss on the same SFT data?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Completion-only loss masks the prompt so gradient flows only into response tokens. Full-sequence loss wastes gradient teaching the model to predict text the user already typed.
Imagine teaching a student to write replies to emails. If you grade them on every word, including the original email they received, half their effort goes into copying back the sender's words instead of writing the reply. So you cover the original email with a sticky note and grade only the reply they actually wrote. Same homework, same time, same effort, but now every red pen mark falls on the part that matters. The student gets better at replies twice as fast. Completion-only loss is exactly that sticky note: it hides the prompt from the grading pen so every correction lands on the response.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: loss masking mechanism + identical forward and attention + prompt-fraction sizing + gradient reallocation + distractor refutation + multi-turn handling + when full-sequence still helps.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming completion-only changes the forward pass or attention. It does not. The full sequence still runs through the model; only the loss aggregation masks out prompt-token positions before backward.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.