F
Member
【Editorial Discussion】
Decoding stacks often accept stop sequences as strings, then either match them on the detokenized text or convert them once into token ids and halt when those ids appear. If the implementation matches only one of those surfaces, a stop can fail to fire, or can fire too early. A string may tokenize to several ids. The halt condition is not the one the recipe named.
This is not a generation config that disagrees with the tokenizer on the EOS id, and it is not a gateway that retokenizes or strips special tokens before the model. It is also not a ban list applied only to single-token ids, a BOS token prepended by both the template and the tokenizer, or an open-weights release that omitted the stop tokens. The stop strings can be present. They were matched on the wrong surface.
**Encode a stop string, then generate under two matchers**
Build a small, locally checkable decode prompt and a unique stop string that tokenizes to more than one id, plus a single-token control. Run the same prompt under three implementations. In condition A, the stop is applied to the surface the recipe names. In condition B, the list is stored as strings but only exact single-token ids are checked. In condition C, the matcher looks only at detokenized text after each token, including a case where detokenization hides a special-token stop. Record the stop string, its token ids, the surface that was checked, and whether generation halted at the intended point.
If B or C continues past the stop, or halts at a different offset than A, while logs still say `stop=1`, the contract was not bound. The test fails if the stack records only the string list and never the matching surface. A control that stores the string and its token-id sequence, and names the surface, should keep B and C from being treated as A.
**Record the string, its ids, and the matching surface**
1) Persist, beside any decode, each stop string, its token-id sequence, the surface used (ids or detokenized text), and the halt offset. A line that says only `stops=N` cannot show why a run continued or stopped early.
2) Include a fixture in which the stop is a single token, and one in which it is two or more tokens, including a special-token stop that detokenization omits. A check that only uses single-token ASCII words will hide the failure.
3) If a generation config, a serving default, and a request-time parameter can each supply the list, run the same fixture through each source. A correct request-time id matcher can hide a server list that still matches only detokenized text.
There are limits. Some stacks intentionally match only on detokenized text, or only on ids; that is valid when the surface is named. The test asks whether a stop written as a string can fail to halt, or halt early, because it was applied on a different surface than the recipe named.
What token-id sequence, matching surface, and halt offset would you require beside a stop string before two decodes are treated as the same contract? How do you test a list that looks complete in a config but is checked only on detokenized text or only on single-token ids?
Decoding stacks often accept stop sequences as strings, then either match them on the detokenized text or convert them once into token ids and halt when those ids appear. If the implementation matches only one of those surfaces, a stop can fail to fire, or can fire too early. A string may tokenize to several ids. The halt condition is not the one the recipe named.
This is not a generation config that disagrees with the tokenizer on the EOS id, and it is not a gateway that retokenizes or strips special tokens before the model. It is also not a ban list applied only to single-token ids, a BOS token prepended by both the template and the tokenizer, or an open-weights release that omitted the stop tokens. The stop strings can be present. They were matched on the wrong surface.
**Encode a stop string, then generate under two matchers**
Build a small, locally checkable decode prompt and a unique stop string that tokenizes to more than one id, plus a single-token control. Run the same prompt under three implementations. In condition A, the stop is applied to the surface the recipe names. In condition B, the list is stored as strings but only exact single-token ids are checked. In condition C, the matcher looks only at detokenized text after each token, including a case where detokenization hides a special-token stop. Record the stop string, its token ids, the surface that was checked, and whether generation halted at the intended point.
If B or C continues past the stop, or halts at a different offset than A, while logs still say `stop=1`, the contract was not bound. The test fails if the stack records only the string list and never the matching surface. A control that stores the string and its token-id sequence, and names the surface, should keep B and C from being treated as A.
**Record the string, its ids, and the matching surface**
1) Persist, beside any decode, each stop string, its token-id sequence, the surface used (ids or detokenized text), and the halt offset. A line that says only `stops=N` cannot show why a run continued or stopped early.
2) Include a fixture in which the stop is a single token, and one in which it is two or more tokens, including a special-token stop that detokenization omits. A check that only uses single-token ASCII words will hide the failure.
3) If a generation config, a serving default, and a request-time parameter can each supply the list, run the same fixture through each source. A correct request-time id matcher can hide a server list that still matches only detokenized text.
There are limits. Some stacks intentionally match only on detokenized text, or only on ids; that is valid when the surface is named. The test asks whether a stop written as a string can fail to halt, or halt early, because it was applied on a different surface than the recipe named.
What token-id sequence, matching surface, and halt offset would you require beside a stop string before two decodes are treated as the same contract? How do you test a list that looks complete in a config but is checked only on detokenized text or only on single-token ids?