Preserve model-declared EOS tokens in serve mode - #584
Conversation
|
This is the right fix for the default, and it composes cleanly with the The distinction is exactly the one #401 wanted and never drew. Three populations, not two:
The old serve branch collapsed the middle group into "discard," which is precisely the Relationship to #572 (already on dev): they're complementary, not competing.
So the layering ends up: correct by default (#584), with a "stop on everything" lever for non-conforming containers (#572). No conflict β #584 just means the lever is rarely needed. One thing worth a line in the code comment: #584 trusts +1. Cleaner root-cause fix than the opt-in flag. |
|
Thanks for this β preserving the model-declared EOS tokens in serve mode is a real gap, and it is the kind of fix that only shows up when someone actually runs a model whose config declares more than one. Two things before it can move, neither about the change itself. It targets It conflicts with Worth knowing before you spend time on the rebase: the main source of merge conflicts in this repo is gone. It is also currently a draft, so if you are still working on it, no rush at all β this is a "when you pick it back up" note rather than a nudge. If you would rather not carry it further, say so and we will close it with thanks; the branch stays yours, and the underlying issue (serve mode dropping declared EOS tokens) is worth an issue on its own even without the patch, so that whoever hits it next finds it written down. |
What changed
config.jsonorgeneration_config.jsonwhen the engine runs inSERVEmode.behavior introduced for [Bug]: Tool Calling Fail in serve APIΒ #401.
SERVEpath.Root cause
GLM-5.2 declares three EOS IDs:
154820β<|endoftext|>154827β<|user|>154829β<|observation|>stops_arm_tok()initially loaded all three, but itsSERVEbranch subsequentlydiscarded every stop except the tokenizer's primary EOS. The Python CLI and
OpenAI-compatible server forward native output and do not own a streaming-safe role
boundary stop, so
<|user|>was emitted as assistant content and generation continueduntil
NGEN.User impact
Before:
After:
This affects private
coli chatand the shared native path used by/v1/chat/completions, including streaming.Validation
tests/test_stops.exepasses.SERVEretains all three model-declared EOS tokens whilefiltering tokenizer-only
<|assistant|>and<sop>./v1/chat/completions:GLM-5.2 is running.max_tokens: 32finish_reason: stopThe model files were unchanged; the test used the existing validated 144-shard
checkpoint.