Skip to content

gate_qwen38_serve: the props clause plans the card and host room the server's --place gate plan record names (a GB10 plans its unified pool) - #1018

Merged
juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-q38-mtp-drafted-greedy
Oct 30, 2026
Merged

juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-q38-mtp-drafted-greedy

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Qwen3.8 serve gate의 drafted arm이 DGX Spark에서 실패하던 비교 기준 두 곳을 고쳤습니다.

What and why

gate_qwen38_serve --arm drafted failed on a DGX Spark in three clauses, and the engine was not at fault. Both defects were in what the gate compares against:

  • The drafted server's greedy ids were held to generate_qwen3moe's ids. The draft's card bytes leave fewer target experts on the card, so the drafted load puts some experts on the host, where sums round another way, and a greedy id differs at a near tie. The drafted arm and the width_cost clause (plain arm, draft on) now take their reference from the same server: one greedy /completion with n_probs, which runs one row at a time and drafts nothing. A new check per clause pins that this request drafted nothing, and the comparison stays an exact match. The re-pin carries PIN(2026-10-30).
  • The /props clause planned with the RTX 3090's card spec and read host memory after the server had loaded, which sent a row-gathered table to NVMe that the server kept on the host. It now plans with the card --place gate resolves to, takes its free bytes from the server's plan record (a unified card's pool), and takes the host room the same record names. On a 3090 the spec and the room are the ones it used before.

Release notes: internal: the Qwen3.8 serve gate's drafted and width chooser clauses compare a drafted load against its own steps and plan the card the server resolved, so the drafted arm passes on a DGX Spark.

Code shape

The review reads these first. A box left unticked needs one line of why.

  • No second copy. Logic two models (or two call sites) share has one common owner; I lifted it there instead of
    copying it (AGENTS.md "Common code first", docs/rust-quality.md R14). Where I found an existing copy, I
    named it below.
  • Model code holds only architecture facts. A model's own files carry only what its architecture forces
    (tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
  • Dead code is gone. Nothing I made unused is left behind (functions, flags, gate clauses, docs).
  • No silent failure. Undefined input is a named error or panic, never a defined-looking output.
  • Comments state what is true now. No dates, issue numbers or how a bug was found (tools/check-comments.sh).
  • No relaxed gate. No band, tolerance or lint moved to make a check pass; a re-pin carries PIN(YYYY-MM-DD):
    and its reason.
  • 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": none. Both clauses share one helper, steps_of, and the draft count is read through serve_client::draft_counts.

What I ran

All runs are gate_qwen38_serve on a DGX Spark (GB10), Qwen3.8-Flash-Next UD-Q4_K_XL (four shards) with the MTP Q8_0 draft, prompt The capital of France is, 16 tokens. The drafted run is

cargo oxide build --arch sm_121a -- -p bloomery-gpu-gates --features deepseek41,gemma-embedding2,hf --release --bin bloomery-serve-qwen38 --bin gate_qwen38_serve
cargo oxide build --arch sm_121a -- -p bloomery-gpu-gates --features gpu --release --bin generate_qwen3moe
bash tools/gpu-gate.sh generate_qwen3moe --place gate --tokens "$REF_TOKENS" -n 16 > gen.log
bash tools/gpu-gate.sh gate_qwen38_serve --arm drafted --gen gen.log --prompt "The capital of France is" --ids "$REF_TOKENS" --dir drafted

Before, on the unchanged gate:

check props_engine_bytes_are_the_plans: FAIL
completion tokens [11751, 13, 11751, 369, 264, 3177, 13, 1942, 9432, 513, 7172, 383, 8964, 13, 15767, 1439] stop_type=limit
generate_qwen3moe [11751, 13, 561, 6511, 314, 9564, 369, 19241, 13, 561, 6511, 314, 14898, 369, 21047, 13]
check drafted_ids_are_the_plain_runs: FAIL
check continued_by_its_own_id_drafts_the_plain_ids: FAIL
check continued_after_windows_keeps_them_and_joins_at_their_end: FAIL
drafted rc 1

After, with the same commands:

plan card bytes 19931604908 (the draft's 2843249068 of it) host bytes 94235274240 kv 262525136; file 111334654784 B in 4 shards
check props_engine_bytes_are_the_plans: PASS
steps on the drafted server: tokens [11751, 13, 11751, 369, 264, 3177, 13, 1942, 9432, 513, 7172, 383, 8964, 13, 15767, 1439] draft_n=0
check drafted_reference_steps_draft_nothing: PASS
completion tokens [11751, 13, 11751, 369, 264, 3177, 13, 1942, 9432, 513, 7172, 383, 8964, 13, 15767, 1439] stop_type=limit
check drafted_ids_are_its_steps: PASS
check continued_by_its_own_id_drafts_the_plain_ids: PASS
check continued_after_windows_keeps_them_and_joins_at_their_end: PASS
gate-gpu-qwen38-serve: PASS
drafted rc 0

The width_cost clause, run alone on the changed gate:

width-cost steps [11751, 13, 11751, 369, 264, 3177, 13, 1942, 9432, 513, 7172, 383, 8964, 13, 15767, 1439] draft_n=0
check width_cost_reference_steps_draft_nothing: PASS
check width_cost_ids_are_its_steps: PASS
check width_cost_draft_counts_carried: PASS
check width_cost_record_is_the_choosers: PASS
gate-gpu-qwen38-serve: PASS
width_cost rc 0

Hardware (if the change is for a machine)

Card Driver CUDA
NVIDIA GB10 (compute capability 12.1), unified memory 595.84 13.3.1

AI help

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

…steps (a plain load places more target experts on the card)
…server's --place gate plan record names (a GB10 plans its unified pool)
@github-actions github-actions Bot added 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 Oct 30, 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 gate compares the same loaded placement and preserves exact token checks.

Non-blocking

⚠ Complete the gate evidence: crates/gpu-gates/src/bin/gate_qwen38_serve.rs:908. The shared props_engine change also affects the plain arm; the supplied excerpts cover the drafted arm and isolated width_cost. Run just gate-gpu-qwen38-serve and attach the output, model files, both tested commit hashes and the nvidia-smi line. This verifies the shared path and makes the GB10 result reproducible.

Checked

Duplicates: 1 new item (steps_of) checked against the shared client and sibling gates; no duplicate owner. No dryer pairs were available.

Complexity: props_engine 54 → 57 adds fallible plan-input setup; drafted_main 17 → 19 adds reference checks; width_cost 23 → 24 adds a count check. These extend existing stages.

Silent failure: 5 record/response paths followed: plan room, card free bytes, HTTP/JSON, token decoding and draft counts. Required record/status/count errors propagate; the drafted reference length is checked before continuation slicing.

Tests, static mutation review: dropping !asks at crates/serve/src/genloop.rs:508 makes the new zero-draft checks fail. Taking proposal ids instead of verified ids at crates/runtime/src/speculative.rs:533 breaks the exact comparisons. Changing placement bytes still fails props_engine_bytes_are_the_plans.

Gates: both replacement token comparisons carry PIN(2026-10-30), reasons and before/after evidence. No numeric band moved.

Adversarial checks: fresh requests reset held state; the reference runs single-row steps; requests with no passes emit no width record; recorded free bytes rebuild the unified pool; given plan room avoids a second drift deduction.

Escape catalog: C1–C4 do not match. Performance: gate tooling only; no engine hot path changed.

Notes

Static review only; card gates were not run here. The supplied evidence lacks the nvidia-smi line and both tested commit hashes, so GPU evidence is false. Diagnostics report that dryer did not run.

Card check: needs-gpu. This pull request changes 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 79bbe70 into midagedev:main Oct 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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