Why does dropping the EOS token from SFT labels produce a model that never stops generating?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
EOS is the stop signal. If training labels never include it, the model never learns to emit it and generation runs until max_new_tokens at inference.
Imagine teaching a child to read aloud, but you never show them what a period looks like or what it means. They will read each sentence into the next sentence without pausing, because nobody ever taught them where a thought is supposed to stop. The EOS token is the period for a language model. The model learns from examples to put it at the end of a complete response, and the generation system watches for it like a listener watching for a pause. If the training data has the period stripped out, the model fluently produces words forever, because it has no idea that stopping is even an option. The fix is always to put the period back into the training labels.
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: define EOS as the stop signal, walk through the training-time and inference-time mechanics, then enumerate the three failure modes (template strip, tokeniser swap, multi-stop mismatch) and the sanity check that catches each.
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.
Stripping EOS during dataset preprocessing because it 'looks like padding' and then wondering why the fine-tuned model rambles forever past the end of its response.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.