Answers for LLM inference engineers

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.

Published 2026-11-13 · Corrected 2026-11-14: Solar Open ends in <|flush|>, two dates moved to UTC, Ollama engine range · Rules read from Transformers v5.22.2, vLLM v0.33.0, SGLang v0.5.23, MLX-LM v0.32.2, llama.cpp b12352 and Ollama v0.40.16 · no model was run

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.

EngineRead atTokens that end generationWatch out for
Transformers generate()v5.22.2eos_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.
vLLMv0.33.0The 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.
SGLangv0.5.23eos_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.cppb12352The 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.
Ollamav0.40.16llama.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-LMv0.32.2eos_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.

ModelTurn ends withgeneration_config.jsonTransformersvLLMSGLangllama.cpp (predicted)MLX-LM
HuggingFaceTB/SmolLM3-3B<|im_end|>presentstopsstopsstopsstopsstops
Qwen/Qwen2.5-7B-Instruct<|im_end|>presentstopsstopsstopsstopsstops
Qwen/Qwen3-8B<|im_end|>presentstopsstopsstopsstopsstops
Qwen/Qwen3.5-4B<|im_end|>missingruns onstopsstopsstopsstops
deepseek-ai/DeepSeek-R1-Distill-Qwen-7B<|end▁of▁sentence|>presentstopsstopsstopsstopsstops
ibm-granite/granite-4.0-micro<|end_of_text|>presentstopsstopsstopsstopsstops
microsoft/Phi-4-mini-instruct<|end|>presentstopsstopsstopsstopsstops
moonshotai/Kimi-K2-Instruct<|im_end|>presentstopsstopsstopsstopsstops
openai/gpt-oss-20b<|return|>presentstopsstopsstopsstopsstops
unsloth/Meta-Llama-3.1-8B-Instruct<|eot_id|>presentstopsstopsstopsstopsstops
unsloth/Mistral-Small-3.2-24B-Instruct-2506</s>presentstopsstopsstopsstopsstops
unsloth/gemma-3-4b-it<end_of_turn>presentstopsstopsstopsstopsstops
unsloth/llama-3-8b-Instruct<|eot_id|>presentstopsstopsstopsstopsstops
zai-org/GLM-4.6nothingpresent—————

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?

SymptomCauseFix
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 onThe uploader copied an older generation_config.json or tokenizer_config.jsonCompare its files with the original model's in the checker above
Only llama.cpp or Ollama runs onThe 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 onA model imported with a hand-written Modelfile lacks PARAMETER stopAdd the stop string and ollama create again
A fine-tuned model runs on everywhereThe training examples did not end with the end-of-turn tokenFix 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 tokenTemplatesWhichIn llama.cpp's built-in list?
<|im_end|>20Bielik-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-1Byes, from b2714 (2024-04-22)
<|end▁of▁sentence|>8Spark2.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-r1yes, from b3909 (2024-10-12)
<|eot_id|>5meetkai-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-Instructyes, from b2702 (2024-04-21) or earlier
</assistant>3poolside-Laguna-S-2.1, poolside-Laguna-XS-2.1, poolside-Laguna-XS.2no: needs eos/eot in the GGUF
<|end_of_text|>3ibm-granite-granite-3.3-2B-Instruct, ibm-granite-granite-4.0, ibm-granite-granite-4.1yes, from b5674 (2025-06-15)
<|end|>2microsoft-Phi-3.5-mini-instruct, unsloth-Apriel-1.5yes, from b2717 (2024-04-24)
<|message_sep|>2GigaChat3-10B-A1.8B, GigaChat3.1-10B-A1.8Bno: needs eos/eot in the GGUF
<|return|>2llm-jp-llm-jp-4.1-8b-thinking, openai-gpt-oss-120byes, from b6096 (2025-08-05)
[e~[2MiniMax-M2, MiniMax-M3yes, from b10141 (2026-07-26)
<SPECIAL_12>1NVIDIA-Nemotron-Nano-v2no: needs eos/eot in the GGUF
<end_of_sentence>1MiniMax-M1no: needs eos/eot in the GGUF
<end_of_turn>1google-gemma-2-2b-ityes, from b2702 (2024-04-21) or earlier
<sep>1Reka-Edgeno: needs eos/eot in the GGUF
<turn|>1google-gemma-4-31B-ityes, from b8637 (2026-04-02)
<|END_OF_TURN_TOKEN|>1CohereForAI-c4ai-command-r-plus-tool_useno: needs eos/eot in the GGUF
<|END_RESPONSE|>1CohereForAI-c4ai-command-r7b-12-2024-tool_useno: needs eos/eot in the GGUF
<|END_TEXT|>1Cohere2MoEno: needs eos/eot in the GGUF
<|close|>1Kimi-K3no: needs eos/eot in the GGUF
<|eot|>1muse-glimmeryes, from b11671 (2026-10-15)
<|flush|>1upstage-Solar-Open-100Byes, from b7603 (2026-01-01)
<|role_end|>1inclusionai-ling-3.0-flashno: 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 textNamed fromDate
<end_of_turn>b2702 or earlier2024-04-21
<|eot_id|>b2702 or earlier2024-04-21
<|im_end|>b27142024-04-22
<|end|>b27172024-04-24
<|endoftext|>b29532024-05-20
<EOT>b38182024-09-24
<|eom_id|>b38182024-09-24
<|end▁of▁sentence|>b39092024-10-12
_<EOT>b50132025-03-31
<|end_of_text|>b56742025-06-15
<end_of_utterance>b58652025-07-10
<|call|>b60962025-08-05
<|return|>b60962025-08-05
<|calls|>b76032026-01-01
<|flush|>b76032026-01-01
[EOS]b79572026-02-06
[EOT]b79572026-02-06
</s>b81102026-02-19
<turn|>b86372026-04-02
<|tool_response>b86652026-04-04
<eos>b87172026-04-08
[e~[b101412026-07-26
<|ifm|im_end|>b114542026-10-06
<|eot|>b116712026-10-15

b2702 compared against <|im_emd|>, a typo; <|im_end|> arrived in b2714 the next day.

How was this built?

What this page does not cover

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