Nodes/ComfyUI-Llama/LLM_Token_EOS
ComfyUI Node

LLM_Token_EOS

The token ID that tells a model when to stop talking

By HairlessPrimate·Created 3 years ago·Updated 2 years ago· 71
LLM_Token_EOS
  • LLM
  • INT

LLMs only stop generating because they decide to - and the way they decide is by producing a special token. The EOS token (end-of-sequence) is the one that says "I'm done." LLM_Token_EOS is a one-job node that looks up your model's EOS token ID and hands it back as an INT.

Its sibling LLM_Token_BOS marks beginnings; this one marks endings, and in practice it's the more consequential of the two. When you're hand-building token sequences for the pack's low-level pipeline (LLM_EvalLLM_Sample), the EOS ID is your termination condition: it's the value you check for to know a generation has finished. In normal use the Call LLM nodes handle this internally and you never think about it - but in the manual loop, detecting "the model just emitted EOS" is the entire difference between a finished reply and an infinite generation.

Input and output

  • LLM - the loaded model. As with BOS, the EOS ID varies by tokenizer, so it must come from the model itself. A common value across many models is 2, but don't hardcode it - that's exactly the bug this node prevents.

The output is INT - the model's EOS token ID.

Where it fits

Realistic uses, all in token-surgery territory:

  1. Loop termination. In the manual sampling loop, after each LLM_Sample you compare the returned token to this node's output. Match = the model is finished, stop sampling. This is the "while token != eos" condition every LLM loop needs, exposed as a value instead of code.
  2. Sequence assembly. When constructing a context by hand, appending EOS can mark the end of one thought before a new one starts - the model will treat everything after it as a fresh turn.
  3. Debugging. If a hand-built sequence produces weird output, checking whether you've accidentally included or omitted EOS markers is a solid first hypothesis. This node makes that check a wire instead of a guess.

If you never touch it - because you're using Call LLM nodes, which handle stopping for you - you're not missing anything. It's a lookup table entry, not a feature.

Install

The pack's standard setup: ComfyUI Manager search "ComfyUI-Llama", or:

cd ComfyUI/custom_nodes
git clone https://github.com/daniel-lewis-ab/ComfyUI-Llama

with pip install llama-cpp-python on manual installs. GGUF models into ComfyUI/custom_nodes/ComfyUI-Llama/models, restart, then Ctrl+F5. Nodes live under the LLM menu.

Bottom line: LLM_Token_EOS is the pack's quiet way of telling you where a generation ends - useful the moment you're doing token-level work, invisible the rest of the time. It's not a workflow node; it's a constant you look up so you don't have to guess.

CategoryLLM

Inputs (1)

NameTypeDefaultDescription
LLMLLM

Outputs (1)

NameTypeDescription
INTINT