LuAITools.com
提交工具
🛑AI
The signal that ends generation

Stop Token

A stop token is a special marker that ends generation when the model produces it — key to controlling output length, avoiding rambling and saving cost.

What is a stop token?

When a large model writes, it spits out one token at a time. It needs to know when to quit — otherwise it'd keep going like a tap left running. A stop token is the special marker that tells the model "that's it". The moment the model generates one, it halts.

What does it look like?

It's a signal, not a word
Stop tokens are usually strings of special symbols like <|endoftext|> or <eos>. Users never see them, but to the model they mean a lot.
There can be several
Some models define multiple stop conditions — end of sentence, a newline, a specific format — so you can control the shape of the output.

Why does it matter?

No rambling, no waste
Without a stop token, the model might keep writing forever, burning tokens and time.
It sets the output boundary
Lots of tasks need precise control over where the answer ends — code completion, JSON generation, multi-turn chat. The stop token is the invisible finish line.
It hits your API bill
Stopping early and accurately saves a chunk of inference cost and makes responses snappier.

How do you use it?

When you call an API you can set a stop parameter listing which strings should end generation. You can also define custom stop sequences so the model wraps up the moment it "finishes". Tuning stop tokens is a basic but real lever on quality and cost.

Bottom line: a stop token is the model's brake — it tells the model exactly where to stop talking.

Comments