# Stop Sequence

> Text that makes the model stop writing as soon as it appears.

**Field:** Artificial Intelligence  
**Category:** LLMs  
**Also known as:** Stop Token, Stop Words (LLM)

## Think of it like

Think of it like a code word. When you hear it, you stop talking right away.

## Definition

A stop sequence is a piece of text that tells the model to stop writing as soon as it produces it. You set one or more, such as a blank line or '###'. The model stops before the stop text, and the reply ends cleanly at that point. It is handy when you only want one item, one line or one turn of a chat. Unlike a token cap, it stops at a place you chose.

## Example

Jack wants one product name, not a list. He sets the stop sequence to a new line, so the model stops after the first name.

## Why it matters

It gives clean endings you can predict. That makes the output easy for a program to use.

## Common mistake

Picking a stop sequence that shows up in normal text. If it is a common word, the reply stops far too early.

## Three principles

- **Text you choose.** Like '###' or a new line.
- **Stops on sight.** Before the stop text.
- **Clean endings.** At a place you picked.

## Related terms

- [Max Tokens](https://learn.benibix.com/term/ai/max-tokens)
- [Token (AI)](https://learn.benibix.com/term/ai/token)
- [LLM Sampling](https://learn.benibix.com/term/ai/sampling)

## Taught in

- [The LLM Context Window](https://learn.benibix.com/learn/ai-llms/llm-context-window): LLMs, 4/15

![Two rows of tokens. In the top row the answer is cut off mid-sentence when it hits the token limit. In the bottom row the answer ends cleanly when the stop sequence appears.](https://learn.benibix.com/diagrams/llm-max-tokens-stop.svg)

---

Source: https://learn.benibix.com/term/ai/stop-sequence
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
