Jargonautica
Language Models Specifically

Stop Sequence

A string that tells generation to end when it appears. Without one, a model will happily carry on past the answer and start writing the next turn of the conversation itself. Setting them correctly is a small detail that removes a whole class of odd output.

Technical view

Matched on the decoded string rather than on tokens, since the target may span token boundaries, and the matched text is normally excluded from the returned output. Interacts with streaming, where a partial match must be buffered rather than emitted. Chat models have implicit stop tokens from their template, and additional application-level sequences are commonly used to terminate structured sections.


Part of AI Terminology Index, section: Language Models Specifically.

How it connects

Stop Sequence links to 4 other terms. The faint lines are links between those terms. See it in the full graph.

Structured OutputStructured OutputStreamingStreamingChat TemplateChat TemplateTermination ConditionTermination Conditi…Stop Sequence