Repository navigation
serve: keep the Qwen3 shared system prompt at message starts - #694
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The changed paths have no must-fix defect.
Non-blocking
⚠ Supply serve-gate results: serve_client.rs:678. Both binaries were built, but neither new clause was run. Run just gate-gpu-qwen3-serve and just gate-gpu-qwen38-serve, including FAIL-first runs with each recurrent seat's marker registration disabled. The reported host mutation proves the helper; these runs check its seat wiring and reused-state token agreement.
⚠ Complete the timing evidence: qwen3.rs:1637. The RTX 5090 TTFT table identifies the model family and quantization, but omits the exact model filename and reproduction commands. Add the server/client commands and their output alongside both hashes, as CONTRIBUTING.md requires.
Checked
Duplicates: three new functions and the relocated MESSAGE_START constant checked. No duplicate owner found. The existing DS41 clause checks its separate chat route and exact restore boundary.
Complexity: plain 31→32, served 62→63, qwen3::run 64→65. Linear clause/setup growth; no new decision tree.
Silent failure: two changed paths followed. An absent marker leaves registration empty as documented; invalid timings.cache_n returns a named gate error.
Tests: replacing bind.rs:128 with Ok(self) fails the expected-[2] assertion; FAIL-first is reported. By inspection, dropping recurrent-seat registration fails the new reuse assertion under the gates' default checkpoint spacing; differing generated ids fail equality.
Gates: shared-system clauses added to both serve gates. No threshold, pin or case relaxed or removed.
Escape catalog: no C1–C4 pattern matched.
Notes
Dryer did not run according to diagnostics.md. This review was static; no tests or card gates were run here.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen38_serve.rs, crates/gpu-gates/src/bin/gate_qwen3_serve.rs, crates/gpu-gates/src/bin/shared/serve_seats/qwen3.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
Qwen3.5와 Qwen3.6 seat가 message 시작에서 prompt를 자르지 않아 공유 system prompt를 재사용하지 못하던 결함(#378)을, 한 곳의 등록 helper로 고치는 PR입니다.
Closes #378.
What and why
The Qwen3 seats never registered
<|im_start|>as the message start, somarked_cutsfound no message starts and the prompt call kept only its end as a checkpoint. A later request that shared the system prompt found no checkpoint below the shared length and prefilled it again. With a 3,000-token system prompt on Qwen3.6 the server log readcommon=3008 ask=3008 kept=0 ... reason=no-checkpoint.Vocab::with_chat_template(crates/gpu-gates/src/bind.rs:119) now registers the message start through the existing strictwith_user_startwhen the chat template and the special-token vocabulary both carry<|im_start|>. The Qwen3 seat (serve_seats/qwen3.rs:1626) calls it, and the Qwen3.8 seat (serve_seats/qwen38.rs) drops its own copy of the condition and calls the same helper, so the rule is written once. The Qwen3 seat reads the chat template first, so the tokenizer is read once.serve_client::shared_system_prompt(crates/gpu-gates/src/serve_client.rs:676) is a new serve gate clause that checks the shared system prompt stays in the slot and that the reused run produces the same ids as a fresh run.gate_qwen3_serveandgate_qwen38_serveboth call it, so each seat's marker registration is guarded.docs/serving.mdnow says that Qwen3.5 and Qwen3.6 keep a shared system prompt in the live slot, and keeps the limits for another conversation taking the slot and for saved states.Release notes: Fixed: Qwen3.5 and Qwen3.6 now reuse a shared system prompt between requests instead of prefilling it each time.
Code shape
Vocab::with_chat_template; both seats call it and the Qwen3.8 copy is removed. The two serve gates share one clause inserve_client.rs.cargo fmtis clean on the touched files. I did not runcargo clippy; the maintainers' lint runs on the PR.Duplication found or removed:
qwen38.rscarried its own message-start condition (removed, nowbind.rs:119).What I ran
Card conditions for the reproduction, from
nvidia-smion an RTX 5090 machine:Host test and FAIL-first, on
29346129.bind.rsand both seat files are identical on the headcd05c6f0.cargo oxide test --arch sm_120 -- -p bloomery-gpu-gates --features deepseek41 --release --lib chat_templates_register_only_a_special_message_start -- --nocapture:test result: ok. 1 passed; 0 failed. It checks four conditions: both markers present, template only, vocabulary only, neither.self.with_user_start(MESSAGE_START)replaced byOk(self), the same test failed withleft: [],right: [2], and the run endedHOST_FAIL_FIRST 101.cargo test -p bloomery-serve --release a_prompt_call_is_cut_at_its_messages -- --nocapture:test result: ok. 1 passed; 0 failed(the existing cut owner test).cd05c6f0, on a DGX Spark,cargo oxide build --arch sm_121 -- -p bloomery-gpu-gates --features deepseek41 --release --bin gate_qwen3_serve --bin gate_qwen38_serveendedFinishedreleaseprofile [optimized] target(s) in 4m 20s.just gate-gpu-qwen3-serveandjust gate-gpu-qwen38-servenot run: I built the two gate binaries (--bin gate_qwen3_serve --bin gate_qwen38_serve) and a maintainer runs the gates.Reproduction on Qwen3.6-35B-A3B Q4_K_M, main
010729edagainst headcd05c6f0, one run of each, seven requests per arm with one generated token each. The system content is 3,000 tokens and the two questions differ, giving prompts of 3,222 and 3,223 tokens with the message start at 3,005. Context 8,192, one slot, draft off, temperature 0. TTFT is the client time to the first token on/completion. The card was idle before the run (CPU_IDLE_PASS load=0.0703125).Server log for the second request, main then head:
The shared-system case drops by 85.03% (derived). The generated token is the same for the fresh and the reused run on both arms (
[8160]).Hardware
NVIDIA GeForce RTX 5090, driver 595.99.02, power cap 400 W. The compile check ran on a DGX Spark.
What I ran into
None of this blocks the PR.
kept=0on both arms). That needs saved-state support for Qwen3.5 and Qwen3.6, which is a separate change. The head's TTFT in that row (234.62 ms against 221.82 ms) is one observation, and I did not separate the cost of the extra checkpoint from run-to-run variation.gate_qwen38_servecompiles, but I did not run it on a Qwen3.8 model. The Qwen3.8 limit of no restore below 4,096 positions from a saved state is unchanged.t0, the full serve gates and lint were not run on my side.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.