A stop token is a special token in a language model's vocabulary that marks the end of a text. Also called the end-of-sequence (EOS) token, it causes the inference system to halt generation and return the response as soon as the model emits it. Each model family uses its own notation, such as `<|im_end|>` in ChatML or `<|eot_id|>` in the Llama family.
A base model that has only been pretrained never learns to stop, because its training data is a continuous stream of text, so it keeps writing until the maximum token limit is reached. Appending a stop token to every assistant response during supervised fine-tuning teaches the model where an answer ends and how to respect conversational boundaries. Stop sequences, user-specified strings that halt generation in an API, serve the same purpose.