Skip to content

generate, beside, serve seats: the draft yield is one rule both seats call, and a drafted plan's refusal other than no room for the context stops the load by name - #1070

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-draft-yield-errors
Nov 1, 2026

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

MTP 초안의 양보(yield) 규칙을 한 곳으로 모아, 초안 계획이 컨텍스트 부족이 아닌 이유로 거절되면 조용히 MTP를 끄지 않고 이름을 붙여 로드를 멈추게 했습니다.

What and why

The Qwen3.8 and GLM serve seats each carried their own copy of the unset draft's yield. Both read every refusal of the drafted context search as "the draft holds no context" (with = 0), so any error in the drafted plan, such as a failed folder read, made the cost rule yield the draft and the plain plan served without MTP, with no error shown.

The rule now has one owner in generate.rs: draft_yield yields only when the drafted plan fits no context the machine may take (FloorShort, CtxDoesNotFit, or HostRoomFloor, read through the family refusal or a bare PlacementError), and returns any other refusal by name. beside::refusal keeps the refusal as the error source, so the type is still readable under an image or embedding reserve. The Qwen3.8 one-slot fallback in auto38 uses the same test instead of treating any error as no fit.

Release notes: Fixed: a drafted plan that fails for a reason other than context room now stops the load with its error instead of serving without MTP.

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): the yield match in serve_seats/qwen38.rs (drafted_rule ... map_or(0, ...)) and the one in serve_seats/glm.rs (drafted.as_ref().map_or(0, ...)) are replaced by one draft_yield call each.

What I ran

On a DGX Spark, with the old rule (Err(_) => Some(0)) put back in draft_yield, the new test fails:

test generate::tests::only_a_context_no_plan_holds_yields_the_draft ... FAILED
  left: Ok("plain 0")
 right: Err("a read of the folder failed")
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 314 filtered out; finished in 0.00s

With the fix, on a DGX Spark:

cargo oxide test --arch sm_121a -- -p bloomery-gpu-gates --features glm5next,clef,vision,mimo2,solar2,minimaxm3,flint,gemma-embedding2,hf,checkpoint --release --lib generate::tests::only_a_context_no_plan_holds_yields_the_draft
test generate::tests::only_a_context_no_plan_holds_yields_the_draft ... ok
cargo oxide test ... --release --bin bloomery-serve auto_slots_keep_the_fitting_host_plan
test serve_seats::qwen38::tests::auto_slots_keep_the_fitting_host_plan ... ok
cargo oxide build ... --release --bin bloomery-serve: rc 0

bloomery-serve --plan on the two Qwen3.8 folders (nvidia/Qwen3.8-Flash-Next-NVFP4, nvidia/Qwen3.8-Flash-Next-FP4-Local) still keeps the draft where it fits, and yields it only for a set context the drafted plan cannot hold:

NVFP4 --parallel 5: ctx rule=fitted ctx=94208 slots=5, draft keep
NVFP4 --parallel auto: ctx rule=target ctx=262144 slots=3, draft keep
FP4-Local --parallel 5: ctx rule=fitted ctx=122880 slots=5, draft keep
FP4-Local --parallel auto: ctx rule=target ctx=262144 slots=3, draft keep
NVFP4 --parallel 5 --ctx-size 512000: draft yield card_bytes=3404499372 with=0 without=102400, ctx rule=set ctx=102400 slots=5

All five plan runs exit 0.

Hardware (if the change is for a machine)

  • Card, driver: NVIDIA GB10, 595.84
  • Arch: sm_121a
  • CUDA: 13.3.1

AI help

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

… both seats call, and a drafted plan's refusal other than no room for the context stops the load by name
@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement 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 shared yield rule propagates non-capacity refusals and preserves the selected plan's context.

Checked

Duplicates: 16 new functions/types checked; no duplicate owner found. Dryer reported 0 pairs in model/placement; gpu-gates checked manually.
Complexity: crapper flagged no functions. The added branches classify load-time refusals; no decode, prefill or kernel work changed.
Silent failure: 4 refusal/default sites followed. Capacity errors permit a plain-plan probe; other errors return to the caller. The saturated subtraction describes an already-guarded shortage.
Tests: static mutation analysis predicts failing assertions for each changed test's protected behavior: drop the source (crates/gpu-gates/src/beside.rs:128); omit the embedding reserve (crates/gpu-gates/src/beside.rs:35); stop traversing wrapped unpaged refusals (crates/gpu-gates/src/generate.rs:402); accept every error as zero context (crates/gpu-gates/src/generate.rs:336); restore the broad auto fallback or reject a discrete host shortage (crates/gpu-gates/src/bin/shared/serve_seats/qwen38.rs:1416); omit context restoration (crates/gpu-gates/src/generate.rs:352); omit the host-shortage class (crates/gpu-gates/src/start.rs:424); emit HostRoom instead of DraftHostRoom (crates/model/src/arch/glm5next/place.rs:1120).
Gates: no existing tolerance, threshold, gate or case removed or relaxed. The PR includes FAIL-first output for the shared refusal regression.
Escape catalog: no C1–C4 pattern matched.
Adversarial checks: unrelated planning errors propagate; a forced draft bypasses the plain probe; a kept draft restores its context note.

Notes

Static review only; tests were not run here. The PR reports the unchanged auto_slots_keep_the_fitting_host_plan test, but no run of the modified auto_slots_keep_the_fitting_drafted_plan test. Complete card evidence is absent: no nvidia-smi line, both tested commit hashes, or just gate-* command/output.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/beside.rs, crates/gpu-gates/src/bin/shared/glm5next_place.rs, crates/gpu-gates/src/bin/shared/routed_legs.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)

Filed outside this PR: #1071

@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 28bc0af 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

gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant