What is the EOS token and how does the runtime use it?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
EOS is a special vocabulary token the model is trained to emit when its answer is complete; the runtime sees it, halts generation, and reports finish_reason=stop.
Picture someone telling a story out loud. They need a way to signal they are done so the listener does not just wait forever. They might say the word period or just go quiet at a clear ending point. The model has the same problem. It writes one word at a time and needs a signal that means stop here. During training it learns one special invisible word for exactly that purpose. The serving system watches the stream of tokens, and the moment that special stop word appears, it ends the reply right away. The word never gets shown to the user. Without that signal the model would keep generating until some other limit kicked in, which would feel sloppy.
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 a vocabulary token the model emits at response end, walk through the sampler-halt mechanic, contrast with max-tokens and stop strings via finish_reason, then cover the multi-EOS reality of modern chat models and how fine-tunes break it.
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.
Confusing EOS with a max-tokens limit or a user-supplied stop string. Only EOS reflects the model's own decision; the other two are external policy.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.