Skip to content

app, serve: one round of any draft's windows verified together; Qwen3.8's lookup windows ride one pass, and whether a load verifies several slots' windows is the body's fact, not the draft's name - #1085

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-cmn-spec-round
Nov 1, 2026

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

여러 슬롯의 draft window를 한 round로 함께 verify하는 일을 공용 owner 하나로 모았고, Qwen3.8 lookup --parallel 2의 round가 슬롯마다 pass 하나에서 round마다 pass 하나로 바뀝니다.

What and why

Verifying several slots' drafted windows in one round lived inside the MTP code, and each serve seat decided the round's shape with its own expression (Qwen3.8 by whether MTP is on, GLM by slots_a_pass, qwen3 and DeepSeek V4.1 by draft name). This PR adds app::Session::verify_rounds, which cuts a round into passes at the body's SlotRows bounds, verifies each pass, picks each row's id and commits the kept rows. The MTP round and the lookup round both call it. On the seat side, serve_seats::rounds::pass_windows runs a round for any draft that implements the new RoundDrafts trait.

Whether a load verifies several slots' windows in one pass is now decided from the body (bind::verifies_slots, read through Pass::of_body), and the Qwen3.8, qwen3, DeepSeek V4.1 and GLM seats read that one decision. As a result, Qwen3.8's lookup draft under --parallel 2 verifies both slots' windows in one pass per round instead of one pass per slot. Qwen3.6 and DeepSeek V4.1 lookup loads keep taking turns, because their bodies do not settle a partial keep. docs/serving.md states both.

The PR makes no speed claim. The greedy output is equal between base and head on every arm below.

Release notes: Under the hood: one shared owner verifies several slots' drafted windows in a round, and Qwen3.8 lookup with two slots runs each round as one pass.

Code shape

  • No second copy. The verify, pick and commit loop that lived in app::mtp::pass_slots moved to Session::verify_rounds, and the per-seat round expressions now read bind::verifies_slots. The two RoundDrafts::choose impls (MTP and lookup) both call runtime::width::Batch::choose, and the two observe impls call Batch::observe.
  • Model code holds only architecture facts. The common owners (verify_rounds, verifies_slots, pass_windows) gained no per-model branch. A body states SETTLES_PARTIAL_KEEP and its SlotRows bounds; seats read them.
  • Dead code is gone. round_mut, the unused widths buffer, the per-seat draft-name expressions and the lookup cost clauses that checked the removed take-turns behavior are deleted.
  • No silent failure. A lookup target that has history refuses an unselected slot's context rebuild by name, and verify_rounds refuses a round of windows that does not fit a pass by name.
  • Comments state what is true now. No dates, issue numbers or how a bug was found.
  • No relaxed gate. No band, tolerance or lint moved. The two gate clauses replaced in gate_qwen38_serve.rs carry a PIN(2026-11-01) line with the reason, and tools/defaults-twins.tsv follows the renamed clause.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line), or "none": the verify, pick and commit loop in crates/app/src/mtp.rs moved into crates/app/src/lib.rs (Session::verify_rounds), and the old lines are deleted. The two RoundDrafts impls in crates/gpu-gates/src/bin/shared/serve_seats/drafted.rs:1218 to :1375 are kept separate because each reads its own table (MTP Spec against LookupWindow), and the width choice and observation sit in one owner.

What I ran

Cards: NVIDIA GB10 (driver 595.84, CUDA 13.3) for the gates and the A/B, and NVIDIA GeForce RTX 5090 (driver 595.99.02) for the qwen3 serve gate. The A/B compares base 28bc0af4b868adef1e0a29ec9cdaab7d1a316a64 with head 852aee2b44996e4a73e38dd61e5bab4e7629b514.

Gates on the cards:

BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-mtp
BLOOMERY_TIER=fixture just gate-gpu-glm5next-mtp
just gate-gpu-qwen38-serve
just gate-gpu-qwen3-serve
just gate-serve-draft-rules
  • gate-gpu-qwen4exp-mtp: gate_qwen4exp_mtp ran 345 s (exit 0).
  • gate-gpu-glm5next-mtp: gate_glm5next_mtp ran 23 s (exit 0).
  • gate-gpu-qwen38-serve on the Qwen3.8 lookup arm, --parallel 2, real tier (Qwen3.8-Flash-Next UD-Q4_K_XL). The head prints lookup cost: 56 of 56 rounds both slots' windows in one pass, 0 in two and check lookup_cost_slots_verify_together: PASS, check lookup_cost_erase_prints_both_slots: PASS, check lookup_cost_0_ids_are_draft_off: PASS, check lookup_cost_1_ids_are_draft_off: PASS.
  • Failing line before the change, from the new gate_qwen38_serve.rs lookup clause run against the code without this PR: lookup cost: 0 of 38 rounds both slots' windows in one pass, 38 in two, check lookup_cost_slots_verify_together: FAIL. The arm's lookup_logprobs_step_without_a_draft check also fails there and with this change; this PR does not touch it.
  • gate-gpu-qwen3-serve on the RTX 5090 with Qwen3.8-27B Q4_K_M, without --images: gate_qwen3_serve ran 87 s (exit 0), 59 checks PASS.
  • gate-serve-draft-rules: serve_seats::qwen38::tests::drafted_rounds_are_one_pass_by_what_body38_verifies ... ok, serve_seats::qwen3::tests::a_drafted_qwen36_round_takes_turns_by_what_its_body_keeps ... ok, and every test result line shows 0 failed.

Speed, base against head, on the GB10 with Qwen3.8 FP4-Local at TP=1, three rounds per side, fp4l-off and fp4l-mtp at C=1 and fp4l-mtp-c2s at C=2. The greedy output is equal between base and head (24 requests, 3,072 tokens, no first difference). Decode tok/s, medians:

Metric Base Head Difference Ranges overlap
fp4l-off code-fn decode tok/s (C=1) 31.573 31.587 +0.04% yes
fp4l-mtp code-fn decode tok/s (C=1) 59.953 59.681 -0.45% no
fp4l-mtp prose-en decode tok/s (C=1) 41.148 41.140 -0.02% yes
fp4l-mtp-c2s code-fn decode tok/s (C=2) 32.869 32.441 -1.30% yes
fp4l-mtp-c2s prose-en decode tok/s (C=2) 26.623 26.790 +0.63% yes

The single-slot arms do not run the new round code: with one slot Pass::of_body returns One like Pass::of, so pass_slots, verify_rounds and pass_windows do not run.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

….8's lookup windows ride one pass, and whether a load verifies several slots' windows is the body's fact, not the draft's name

Session::verify_rounds owns a round of several slots' windows (passes cut at
the body's SlotRows bounds, each row's id taken, the kept rows committed); the
MTP round and the lookup round both call it, and the seats' round driver
(rounds::pass_windows) runs any draft that implements RoundDrafts.
bind::verifies_slots decides from the body whether a load verifies several
slots' windows in one pass, and Pass::of_body is the one rule the Qwen3.8,
qwen3, V4.1 and GLM opens read.

2026-11-01: gate_qwen38_serve's lookup cost clause checks the new shape.
lookup_cost_slots_verify_together replaces lookup_cost_slots_take_turns, and
lookup_cost_erase_prints_both_slots replaces
lookup_cost_warm_up_ends_on_both_slots: under one pass a round, the round's
chooser (runtime::width::Batch) reads the wall and a slot's own chooser only
counts its rows, so the per-slot cost cells that clause read stay empty.
@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card labels Nov 1, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: The changed paths have no proven behavior or quality defect that requires changes.

Non-blocking

⚠ Cover batch-cost observation wiring: crates/gpu-gates/src/bin/gate_qwen38_serve.rs:6305
Removing drafts.observe(...) leaves the new batching and erase assertions green while the batch chooser stays in warm-up. Add a deterministic integration check with forced proposals that detects missing observations. This protects the connection that the runtime's isolated chooser tests cannot cover.

⚠ Supply evidence for lookup batching: crates/gpu-gates/src/bin/shared/serve_seats/qwen38.rs:3595
At two busy slots, two target passes become one pass with up to four rows [derived]. This changes launch count and row geometry. The supplied A/B covers MTP and draft-off arms. Add the lookup A/B required for geometry changes and the identical PTX comparison for the shared-code move.

Optimization headroom

  • G. Per-launch and per-sync fixed cost: crates/gpu-gates/src/bin/shared/serve_seats/rounds.rs:511 Pass the existing done slice to observe and map its counts inside the implementations. This removes one allocation and 8 bytes per participating slot per cost-mode round [derived, 64-bit host].

Checked

Duplicates: 42 added declarations/signatures checked, including moved items; no duplicate knowledge found. Dryer reported zero pairs; gpu-gates was searched manually.
Complexity: lookup_cost_rounds (24) is a renamed gate with record filters and error checks. ds41::run (59→62) and qwen38::run (151→154) add exhaustive draft-selection arms; harmless growth.
Silent failure: five missing-slot defaults/skips followed; width validation rejects missing drafts before those consumers. No-proposal lookup windows intentionally verify one row.
Tests: static mutation checks only. Dropping SETTLES_PARTIAL_KEEP makes the Qwen3.6 assertion fail; changing >1 to >=1 makes the Qwen3.8 assertion fail. Restoring serial lookup rounds fails the batching clause; dropping round tallies fails the erase clause. Missing observation coverage is noted above.
Gates: two replaced clauses carry PIN(2026-11-01) and a reason; no tolerance moved.
Adversarial paths: context exhaustion is blocked by Gen::pump; partial keeps are checked before execution; slot positions and sampled histories remain separate across reordered passes.
Escape catalog: no C1–C4 pattern matched.

Notes

Static review only; builds and GPU gates were not run here. Dryer excluded gpu-gates as documented. The PR omits nvidia-smi output and cites A/B commits different from this review's base/head. GPU evidence is false under the required evidence format.

Card check: needs-gpu. This pull request changes crates/app/src/lib.rs, crates/app/src/mtp.rs, crates/gpu-gates/src/bin/gate_qwen38_serve.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)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit 41c74a5 into midagedev:main Nov 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant