Repository navigation
fix(server): close disaggregated router parity residuals from #2700 - #2719
Merged
Merged
Conversation
Router non-stream chat content now matches single node. The no-tools shaping in the single-node chat route moves into shape_plain_chat_reply, which the single-node path and the router's non-stream branch both call; the router accumulates the raw handoff text and shapes it once, so a SentencePiece " Café" becomes "Café" on both. --skip-chat-parsing still returns the raw text and the streaming branch is unchanged. Llama3Model reports the checkpoint's own EOS ids. llama3::ModelArgs reads eos_token_id (int or list); eos_token_ids() returns the declared ids and appends 128001/128009 only for the Llama 3.x vocabulary (128256), so MiniCPM-2B reports [2] instead of two out-of-vocabulary ids. The #2695 decode-intake regression asserts [2] and then restores its premise with set_eos_token_ids. prompt_tokens_details follows the worker. ResultFrame gains an optional prompt_cache_enabled that the prefill node sets on its successful first-token frame from BatchScheduler::has_prompt_cache_store(); all four router usage builders use it and fall back to the router's own flag for an older prefill node. Validated on GB10: router_front, routes::chat, llama3, headless_llama, serving_protocol and serving_handoff_parity (with ignored) lib tests, disaggregated_router_e2e 7/7 and disaggregated_serving_e2e 2/2, clippy and fmt clean. Closes #2715
The new eos_token_id: None had been inserted between the checkpoint_label comment and its field, so the comment read as describing eos_token_id. Move it above the comment and give it its own one-line note. Validation: cargo fmt --check, clippy -D warnings (lib and tests), and models::helium (28 passed) all clean. Refs #2715
inureyes
marked this pull request as ready for review
October 28, 2026 13:24
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clean_structural_tokens, answer wrapper, unclosed primed thinking,--reasoning-formatplacement, reasoning extraction) is nowroutes::chat::shape_plain_chat_reply. Single node calls it, and the router's non-stream branch accumulates the raw handoff text and shapes it with the same helper, so" Café"becomes"Café"on both.--skip-chat-parsingstill returns raw text, and streaming is unchanged (neither side trims a stream).llama3::ModelArgsreadseos_token_id(int or list).eos_token_ids()returns the declared ids, deduplicated, and appends 128001/128009 only for vocab 128256. It never invents ids.Llama3Modelstores the result and gainsset_eos_token_ids. MiniCPM-2B now reports[2]. The fix(distributed): disaggregated serving and router e2e tests fail on main #2695 regression asserts[2], then sets[128001, 128009]so the decode-intake premise still holds.prompt_tokens_detailsfollows the worker.ResultFrame.prompt_cache_enabled: Option<bool>(serde(default)) is set on the prefill node's successful first-token frame fromBatchScheduler::has_prompt_cache_store(). Error and decode frames carryNone.HandoffOutcomecarries it, and all four usage builders useprompt_cache_enabled.unwrap_or(router flag). Docs:docs/CONTINUOUS_BATCHING.md(no Korean counterpart exists).Failing-first evidence (main 752db4f, new tests written before the fix)
disaggregated_router_chat_usage_matches_single_node_byte_fallback:router non-stream content diverges from single-node,left: String(" Café"),right: String("Café").router_front_tests::router_non_stream_chat_content_is_shaped_like_single_node(a fake prefill peer sends[" Café"]):left: String(" Café"),right: String("Café").prompt_tokens_details_omitted_when_the_worker_cache_is_off: chat usage still had{"cached_tokens":0}(left: Some(..),right: None).prompt_tokens_details_present_when_the_worker_cache_is_on:left: None.left: [128001, 128009],right: [2].Nonefallback test (it pins the unchanged behavior for older nodes) and the qwen3 non-stream thinking comparison (both sides returncontent: ""and the same reasoning at 32 tokens). Thellama3_testsEOS cases,shape_router_chat_reply_matches_the_single_node_shaping, and theserving_protocolmissing-key case test new API, so they cannot compile on main.Test plan
All with
MLXCEL_REQUIRE_MODELS=1 MLXCEL_SDPA_DETERMINISTIC=1undergpu-lock run --tag issue-2715,--profile test-fast, built outside the lock first.cargo fmt --check.cargo clippy --profile test-fast --features cuda -p mlxcel --lib --tests -- -D warningsis clean.--features cuda,--test-threads=1):server::router_front40/40,server::routes::chat73/73,models::llama334/34,models::headless_llama3/3,distributed::disaggregated::serving_protocol19/19,serving_handoff_parity --include-ignored6/6. Alsomodels::llama_bidirec9/9,models::helium28/28, anddistributed::tensor_parallel::llama_runtime35 passed, 4 ignored.--features cuda,test-utils --test disaggregated_router_e2e -- --include-ignored --test-threads=1: 7/7 (49 s), no skips.--test disaggregated_serving_e2e: 2/2.mlxcel-serveron 127.0.0.1:19701 withminicpm-2b-sft-4bit-llama-format-mlx,max_tokens16. "café" returns"Café"withfinish_reason: stopandcompletion_tokens: 1. "Чай" returns"Чай"withstopand 4 tokens. Both stop at</s>.Out of scope, noted for follow-up: single node's non-stream reply also carries
reasoning_only: truewhen the reply is all reasoning. The router does not emit that extension field.Closes #2715
Behavior changes
--reasoning-format noneanddeepseek-legacynow follow single node's non-stream form instead of mirroring the router's streamed form (fix(server): close remaining streamed vs non-streamed output gaps #2464), so router stream and non-stream agree only as far as single node's do.Llama3Modelreports the EOS ids its config declares: a Llama 3.1 Instruct checkpoint now also reports 128008 (<|eom_id|>); a Llama 3 derivative with a resized vocabulary no longer gets 128001/128009 appended; a llama-format checkpoint with noeos_token_idand a non-Llama-3 vocabulary reports none. In-tree generation already merges sidecar EOS ids, so only the llava wrapper and the tensor-parallel runtime see the difference.prompt_cache_enabledonResultFrame, the prefill node's setting decidesprompt_tokens_details; a router talking to an older node falls back to its own flag.