Why does my model not stop generating? The end-of-turn token, and which engines stop on it
A chat model ends its answer with one special token, written by its chat template: <|eot_id|> for Llama 3, <|im_end|> for Qwen, <end_of_turn> for Gemma 2 and 3, <turn|> for Gemma 4. Generation stops only if the engine counts that token as an end token, and each engine builds that set from different files. Transformers reads generation_config.json, vLLM adds the tokenizer's eos_token, llama.cpp reads the GGUF and a list of 24 built-in token texts, and Ollama adds the Modelfile's stop strings. Paste a model's files below to see where each engine stops.
Which engines will stop on my model's end-of-turn token?
Fetch a public model from Hugging Face, or paste its files. For a GGUF, paste the lines that llama.cpp prints while loading (they start with printing all EOG tokens) to replace the prediction with the real set.
Runs in your browser. Only the Fetch button contacts huggingface.co, for the four small files and, if needed, tokenizer.json. Gated models (Llama, Gemma) have to be pasted. The chat template is rendered with @huggingface/jinja 0.5.13, the renderer Transformers.js uses.
Where does each engine get its end tokens?
Six engines, six rules. The same model files can stop in one engine and run on in another. Each row was read from the source of the release named.
| Engine | Read at | Tokens that end generation | Watch out for |
|---|---|---|---|
Transformers generate() | v5.22.2 | eos_token_id of generation_config.json. Without that file, the one in config.json (top level, else text_config). The tokenizer's eos_token is not added. | If generation_config.json exists but has no eos_token_id, there is no end token at all. |
| vLLM | v0.33.0 | The tokenizer's eos_token, plus eos_token_id of generation_config.json (or of config.json when that file is missing), plus the request's stop_token_ids. | --generation-config vllm drops the sampling defaults, not these tokens. ignore_eos turns the end tokens off. |
| SGLang | v0.5.23 | eos_token_id of config.json (top level) and of generation_config.json, the tokenizer's eos_token, three built-in extras when the vocabulary has them (<|eom_id|>, <|content_model_end_sampling|>, <|ifm|im_end|>), and the request's stop_token_ids. | The widest net of the six. |
| llama.cpp | b12352 | The end-of-generation (EOG) set: the GGUF's eos, eot and eom ids, the FIM pad, repo and separator tokens, and every vocabulary token whose text is in a built-in list (24 texts in b12352). | Two exceptions remove tokens again: <|end|> when <|return|> and <|call|> exist (gpt-oss) or <|calls|> and <|flush|> exist (Solar Open), and </s> for Gemma 4, PLaMo and Beam. |
| Ollama | v0.40.16 | llama.cpp's EOG set from the GGUF (Ollama runs llama-server and passes the request on), plus the stop strings from the Modelfile and the request. | The EOG list is that of the llama.cpp build Ollama bundles; the GGUF lookup lists it per release. |
| MLX-LM | v0.32.2 | eos_token_id of config.json (top level), replaced by the one in generation_config.json when that is set, plus the tokenizer's eos_token. | --extra-eos-token adds more. |
What does the checker say about popular models?
13 of 14 public models stop correctly in all six engines by these rules. The exception is Qwen/Qwen3.5-4B: its repository has no generation_config.json, and its config.json lists only <|endoftext|> (248044, inside text_config), so Transformers' generate() would not stop at <|im_end|>. vLLM, SGLang and MLX-LM still stop there because they add the tokenizer's eos_token, which is <|im_end|>. The 27B model of the same family ships a generation_config.json with both ids.
| Model | Turn ends with | generation_config.json | Transformers | vLLM | SGLang | llama.cpp (predicted) | MLX-LM |
|---|---|---|---|---|---|---|---|
| HuggingFaceTB/SmolLM3-3B | <|im_end|> | present | stops | stops | stops | stops | stops |
| Qwen/Qwen2.5-7B-Instruct | <|im_end|> | present | stops | stops | stops | stops | stops |
| Qwen/Qwen3-8B | <|im_end|> | present | stops | stops | stops | stops | stops |
| Qwen/Qwen3.5-4B | <|im_end|> | missing | runs on | stops | stops | stops | stops |
| deepseek-ai/DeepSeek-R1-Distill-Qwen-7B | <|end▁of▁sentence|> | present | stops | stops | stops | stops | stops |
| ibm-granite/granite-4.0-micro | <|end_of_text|> | present | stops | stops | stops | stops | stops |
| microsoft/Phi-4-mini-instruct | <|end|> | present | stops | stops | stops | stops | stops |
| moonshotai/Kimi-K2-Instruct | <|im_end|> | present | stops | stops | stops | stops | stops |
| openai/gpt-oss-20b | <|return|> | present | stops | stops | stops | stops | stops |
| unsloth/Meta-Llama-3.1-8B-Instruct | <|eot_id|> | present | stops | stops | stops | stops | stops |
| unsloth/Mistral-Small-3.2-24B-Instruct-2506 | </s> | present | stops | stops | stops | stops | stops |
| unsloth/gemma-3-4b-it | <end_of_turn> | present | stops | stops | stops | stops | stops |
| unsloth/llama-3-8b-Instruct | <|eot_id|> | present | stops | stops | stops | stops | stops |
| zai-org/GLM-4.6 | nothing | present | — | — | — | — | — |
Files fetched from Hugging Face on 2026-11-13. Gated models were read from Unsloth's public copies, whose files can differ from the originals (Unsloth's Llama 3 copy, for example, sets the tokenizer's eos to <|eot_id|>). GLM-4.6's template writes nothing after the answer; the model ends with <|user|> or <|observation|>, which its config lists. The Ollama column is the same as llama.cpp here and is left out. No model was run.
What are the usual reasons a model does not stop?
| Symptom | Cause | Fix |
|---|---|---|
Llama 3 Instruct runs past <|eot_id|> | The tokenizer's eos is <|end_of_text|>; <|eot_id|> (128009) is listed only in generation_config.json. Engines or copies without that list stop only at <|end_of_text|>. | An engine that reads generation_config.json (vLLM from v0.4.1), or stop_token_ids=[128009] |
| Only the quantized or converted copy runs on | The uploader copied an older generation_config.json or tokenizer_config.json | Compare its files with the original model's in the checker above |
| Only llama.cpp or Ollama runs on | The GGUF's eos/eot ids point elsewhere and the end token is not in the built-in list of your build (see the table below) | A newer build, a GGUF converted with a newer llama.cpp, or --override-kv |
| Only Ollama runs on | A model imported with a hand-written Modelfile lacks PARAMETER stop | Add the stop string and ollama create again |
| A fine-tuned model runs on everywhere | The training examples did not end with the end-of-turn token | Fix the training data; no engine setting helps |
Which end-of-turn tokens does llama.cpp recognize by name?
Of the 74 chat templates that llama.cpp keeps for its tests, 59 end the assistant's turn with a token, 9 write nothing after it, and 6 could not be rendered with a simple conversation. 10 of the end tokens found are not in llama.cpp's built-in list; for those 13 templates, llama.cpp stops only if the GGUF's eos or eot id points at the token, so the converter has to get it right.
| End-of-turn token | Templates | Which | In llama.cpp's built-in list? |
|---|---|---|---|
<|im_end|> | 20 | Bielik-11B-v3.0-Instruct, HuggingFaceTB-SmolLM3-3B, Kimi-K2-Instruct, Kimi-K2-Thinking, LFM2-8B-A1B, LFM2.5-8B-A1B, LFM2.5-Instruct, LFM3, MiMo-VL, NVIDIA-Nemotron-3-Nano-30B-A3B-BF16, NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use, NousResearch-Hermes-3-Llama-3.1-8B-tool_use, Qwen-QwQ-32B, Qwen-Qwen2.5-7B-Instruct, Qwen-Qwen3-0.6B, Qwen3-Coder, Qwen3.5-4B, StepFun3.5-Flash, moonshotai-Kimi-K2, openbmb-MiniCPM5-1B | yes, from b2714 (2024-04-22) |
<|end▁of▁sentence|> | 8 | Spark2.5, deepseek-ai-DeepSeek-R1-Distill-Llama-8B, deepseek-ai-DeepSeek-R1-Distill-Qwen-32B, deepseek-ai-DeepSeek-V3.1, deepseek-ai-DeepSeek-V3.2, deepseek-ai-DeepSeek-V4-Flash-0731, deepseek-ai-DeepSeek-V4, llama-cpp-deepseek-r1 | yes, from b3909 (2024-10-12) |
<|eot_id|> | 5 | meetkai-functionary-medium-v3.1, meetkai-functionary-medium-v3.2, meta-llama-Llama-3.1-8B-Instruct, meta-llama-Llama-3.2-3B-Instruct, meta-llama-Llama-3.3-70B-Instruct | yes, from b2702 (2024-04-21) or earlier |
</assistant> | 3 | poolside-Laguna-S-2.1, poolside-Laguna-XS-2.1, poolside-Laguna-XS.2 | no: needs eos/eot in the GGUF |
<|end_of_text|> | 3 | ibm-granite-granite-3.3-2B-Instruct, ibm-granite-granite-4.0, ibm-granite-granite-4.1 | yes, from b5674 (2025-06-15) |
<|end|> | 2 | microsoft-Phi-3.5-mini-instruct, unsloth-Apriel-1.5 | yes, from b2717 (2024-04-24) |
<|message_sep|> | 2 | GigaChat3-10B-A1.8B, GigaChat3.1-10B-A1.8B | no: needs eos/eot in the GGUF |
<|return|> | 2 | llm-jp-llm-jp-4.1-8b-thinking, openai-gpt-oss-120b | yes, from b6096 (2025-08-05) |
[e~[ | 2 | MiniMax-M2, MiniMax-M3 | yes, from b10141 (2026-07-26) |
<SPECIAL_12> | 1 | NVIDIA-Nemotron-Nano-v2 | no: needs eos/eot in the GGUF |
<end_of_sentence> | 1 | MiniMax-M1 | no: needs eos/eot in the GGUF |
<end_of_turn> | 1 | google-gemma-2-2b-it | yes, from b2702 (2024-04-21) or earlier |
<sep> | 1 | Reka-Edge | no: needs eos/eot in the GGUF |
<turn|> | 1 | google-gemma-4-31B-it | yes, from b8637 (2026-04-02) |
<|END_OF_TURN_TOKEN|> | 1 | CohereForAI-c4ai-command-r-plus-tool_use | no: needs eos/eot in the GGUF |
<|END_RESPONSE|> | 1 | CohereForAI-c4ai-command-r7b-12-2024-tool_use | no: needs eos/eot in the GGUF |
<|END_TEXT|> | 1 | Cohere2MoE | no: needs eos/eot in the GGUF |
<|close|> | 1 | Kimi-K3 | no: needs eos/eot in the GGUF |
<|eot|> | 1 | muse-glimmer | yes, from b11671 (2026-10-15) |
<|flush|> | 1 | upstage-Solar-Open-100B | yes, from b7603 (2026-01-01) |
<|role_end|> | 1 | inclusionai-ling-3.0-flash | no: needs eos/eot in the GGUF |
"Writes nothing after it" means the template relies on the model emitting an eos token (GLM and Apertus, for example). Rendering used one user and one assistant message; templates that require tools or special content fields failed and are counted as not rendered. Solar Open is listed by what the model generates: its template closes past turns with <|end|>, but a generated answer ends in <|flush|> (a tool call in <|calls|>); the model's generation_config.json lists those two and not <|end|>, and llama.cpp takes <|end|> out of the set for this vocabulary. gpt-oss works the same way with <|return|>.
From which llama.cpp build is each text in the list?
The first bNNNN release whose vocabulary code compares token texts against each name. A GGUF whose eos or eot id already points at the token stops in older builds too; before b2702 (2024-04-21) there was no end-of-generation set at all, only the eos id.
| Token text | Named from | Date |
|---|---|---|
<end_of_turn> | b2702 or earlier | 2024-04-21 |
<|eot_id|> | b2702 or earlier | 2024-04-21 |
<|im_end|> | b2714 | 2024-04-22 |
<|end|> | b2717 | 2024-04-24 |
<|endoftext|> | b2953 | 2024-05-20 |
<EOT> | b3818 | 2024-09-24 |
<|eom_id|> | b3818 | 2024-09-24 |
<|end▁of▁sentence|> | b3909 | 2024-10-12 |
_<EOT> | b5013 | 2025-03-31 |
<|end_of_text|> | b5674 | 2025-06-15 |
<end_of_utterance> | b5865 | 2025-07-10 |
<|call|> | b6096 | 2025-08-05 |
<|return|> | b6096 | 2025-08-05 |
<|calls|> | b7603 | 2026-01-01 |
<|flush|> | b7603 | 2026-01-01 |
[EOS] | b7957 | 2026-02-06 |
[EOT] | b7957 | 2026-02-06 |
</s> | b8110 | 2026-02-19 |
<turn|> | b8637 | 2026-04-02 |
<|tool_response> | b8665 | 2026-04-04 |
<eos> | b8717 | 2026-04-08 |
[e~[ | b10141 | 2026-07-26 |
<|ifm|im_end|> | b11454 | 2026-10-06 |
<|eot|> | b11671 | 2026-10-15 |
b2702 compared against <|im_emd|>, a typo; <|im_end|> arrived in b2714 the next day.
How was this built?
- Engine rules: read from
generation/utils.pyandgeneration/configuration_utils.py(Transformers v5.22.2),sampling_params.py,v1/engine/input_processor.pyandtransformers_utils/config.py(vLLM v0.33.0),configs/model_config.py,managers/schedule_batch.pyandutils/hf_transformers/common.py(SGLang v0.5.23),utils.pyandtokenizer_utils.py(MLX-LM v0.32.2),src/llama-vocab.cppandgguf-py/gguf/vocab.py(llama.cpp b12352),llm/llama_server.go(Ollama v0.40.16). - llama.cpp lists: the token texts compared in
src/llama-vocab.cppat b12352, extracted by a script; the first build for each by binary search over the release tags. - Predicted GGUF ids: without a load log, the checker takes the eos the converter would write (tokenizer_config.json's
eos_token, else config.json'seos_token_id). Some converters set eot or eom as well, which only adds tokens. - Templates: llama.cpp's
models/templatesat b12352, rendered with @huggingface/jinja 0.5.13.
What this page does not cover
- No model was run. The checker reports which tokens each engine treats as the end; whether the model emits that token is up to its weights.
- Stop strings in requests (
stop) are matched on text and work in every engine; they are not part of the table. - Older releases of Transformers, vLLM, SGLang and MLX-LM may differ; vLLM began reading
eos_token_idfrom generation_config.json in v0.4.1 (2024-04). - Ollama's MLX runner on macOS and its older own engine (0.5.12 to 0.24.0; from 0.30.0 Ollama runs llama-server) are not covered.
Questions
- Why does Llama 3 Instruct keep generating after <|eot_id|>?
- Its tokenizer's eos_token is <|end_of_text|>, while a chat turn ends with <|eot_id|>. The second one is only listed in generation_config.json (eos_token_id [128001, 128009]). An engine or copy of the model that does not read that list stops only at <|end_of_text|>, which the model rarely emits in chat. vLLM reads it from v0.4.1.
- Which file decides where generation stops?
- It depends on the engine. Transformers' generate() uses generation_config.json (or config.json when that file is missing) and ignores the tokenizer's eos_token. vLLM adds the tokenizer's eos_token to that. SGLang adds config.json as well. llama.cpp uses the eos, eot and eom ids stored in the GGUF plus a built-in list of token texts. Ollama passes stop strings from the Modelfile to llama.cpp.
- How do I make vLLM stop on a token?
- Send "stop_token_ids": [ID] in the request, or start vLLM with --generation-config pointing at a directory whose generation_config.json lists the id in eos_token_id.
- How do I make llama.cpp or Ollama stop on a token?
- For llama.cpp, --override-kv tokenizer.ggml.eos_token_id=int:ID makes that token the eos, and the eos is always in the end-of-generation set. For Ollama, add PARAMETER stop "<token>" to the Modelfile and run ollama create.
- My fine-tuned model never stops, but the base model does. Why?
- If the training examples did not end with the end-of-turn or eos token, the model never learned to emit it. No engine setting fixes that; add the token to the end of every training example and train again.
Related: Minimum Transformers, vLLM and llama.cpp version for a model · GGUF architecture lookup · Why logprobs differ between engines.
Sources
- Transformers: generation/utils.py, configuration_utils.py
- vLLM: sampling_params.py, transformers_utils/config.py, PR #4182, issue #4180
- SGLang: model_config.py, schedule_batch.py
- llama.cpp: src/llama-vocab.cpp, models/templates, issue #9606
- MLX-LM: tokenizer_utils.py; Ollama: llm/llama_server.go, Modelfile
- Reports: Meta-Llama-3-8B-Instruct #26, exl2 thread, forgather: eos and generate stopping