Stop Sequence Tester
See exactly where your stop strings fire in a sample output, which one wins, and what the API would return.
"\n\nQuestion:" matched first, at line 2, column 68. 69.8% of the text survives.
- Sequences configured
- 2
- Sequences that match at all
- 1
- Total matches in the sample
- 1
- Characters kept
- 111 of 159
- Estimated tokens before
- ≈ 55
- Estimated tokens after
- ≈ 36
- "\n\nQuestion:"1× — first at 111
- "###"never
- "\n\nQuestion:" has leading or trailing whitespace. Whitespace is usually attached to the neighbouring token, so a stop that depends on it is the most common one that never fires.
Stop sequences fail in one direction, quietly
The failure that costs time is not a stop sequence that does not fire; it is one that fires somewhere you did not look. A sequence like \n\n is a reasonable way to end a single-paragraph completion and a catastrophic one the moment the model produces a list, because the list’s first blank line ends the response. The result is a truncated answer with finish_reason: stop, which looks exactly like a model that finished, so nothing alerts and the bug gets attributed to the model. Paste a few real outputs above and look at the match counts: any sequence matching more than once in normal output is a bug waiting for the right input.
The second trap is whitespace. Tokenizers usually attach a leading space to the following word, so a stop string that starts with a space may never exist as a boundary in the generated text even though it appears in the rendered output. Prefer sequences that begin at a newline or a punctuation-like marker, and prefer distinctive markers to short ones.
Worth remembering on the bill: the stop happens at the provider, but the tokens generated up to and including the match are generated, and are normally billed. Stop sequences are an output-formatting control, not a cost control. If the goal is a shorter answer, ask for a shorter answer and cap max_tokens.