Repository navigation
serve: Qwen3.8 slots save to a file and restore from it, the MTP draft's side with them - #1027
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: Restore accepts an image placeholder in a saved text history and uses it without a named refusal.
Must fix
1. Reject image placeholders in saved text histories
crates/gpu/src/arch/qwen3moe/body38.rs:5610 passes true for every history token's image-span flag. On a model with ple.image_token_id, changing a current or checkpoint history token to that reserved ID therefore passes restore. Slot snapshots refuse images and carry no image rotation state. Resume installs the history at body38.rs:4022. A continuation reusing that history reaches crates/engram/src/hash.rs:608, which hashes its prior tokens without validating them again. This is a kind A failure: invalid text history affects inference instead of producing a named error.
Enforce the existing text-token contract while this file format is new. Replace line 5610 with:
.check(t)Extend the PLE corruption clause to substitute the image placeholder in both current and checkpoint histories and require HTTP 400. Its present past-vocabulary mutation passes on this defect.
Checked
Duplicates: diagnostics report no dryer pairs; gpu and gpu-gates were excluded from that scan.
Complexity: diagnostics flag six functions. Complexity alone supplies no finding.
Silent failure: saved PLE IDs traced through seq_take, load_state, and Hash::ple_rows_spanned; the image-span bypass reaches the consumer.
Tests: the PLE corruption clause at gate_qwen38_serve.rs:5475 substitutes u32::MAX; it does not exercise the reserved image ID. Validation was static; no build or GPU gate was run.
Gates: no tolerance, threshold, lint level, or existing gate clause relaxed; no re-pin required.
Escape catalog: C1–C4 do not apply to the retained finding. No ledger lessons are in force.
Notes
The supplied GPU gate command contains ...; attach the complete invocation and resolved model file for verification evidence. The PR also supplies no PTX sameness output for the extracted walk check.
Card check: needs-gpu. This pull request changes crates/app/src/mtp.rs, crates/app/src/mtp/policy.rs, crates/gpu-deepseek41/src/body/snap.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)
| }; | ||
| for &t in state.values().flat_map(History::tokens) { | ||
| window | ||
| .check_at(t, true) |
There was a problem hiding this comment.
Slot snapshots refuse image state; validate saved history IDs as text so the reserved image placeholder is refused.
| .check_at(t, true) | |
| .check(t) |
c838a9d to
e7afc96
Compare
There was a problem hiding this comment.
Since the last review: the image-placeholder must-fix is fixed. body38.rs:306 uses the existing text-token validator for every current and checkpoint history.
Verdict: CLEAN: The restore bypass is closed, and no new must-fix survives the interdiff review.
Checked
Duplicates: 2 new functions checked; no duplicate owner. The validator reuses EosWindow::check. Dryer reports 0 pairs; gpu and gpu-gates were excluded, so the new items were searched manually.
Complexity: slot_file (76) adds corruption-test branches. The other flags are unchanged by this interdiff: SeqState::take (43), SeqState::put (30), slot_file_off_draft (28), Parked::take (21), and drafted_main (20).
Silent failure: 2 error paths followed. Invalid histories produce a named HTTP 400 before resume; model-metadata failures return a gate error.
Tests: Static mutation check: replacing .check(t) at body38.rs:306 with .check_at(t, true) makes the new unit test's image rejection and the HTTP image-refusal clause fail. Checking only the current history makes the checkpoint-corruption clause fail. Dropping the length check or checking only one token makes unit assertions fail. No build or GPU test was run in this review.
Gates: No band, threshold, lint level, or existing clause was relaxed. No PIN required.
Adversarial checks: Image IDs in older history positions and checkpoints are rejected; EOS and the last valid text ID pass. Wrong history lengths and mapped windows return named errors. The changed production path is file restore, outside decode and prefill.
Escape catalog: C1–C4 have no matching pattern in the interdiff.
Notes
The GPU command remains abbreviated with ... and unresolved model/input paths, so the supplied evidence is incomplete. The earlier PTX sameness evidence is still absent. The new image-refusal clause has PASS output, but no FAIL-first output for reinstating the image-span bypass.
Card check: needs-gpu. This pull request changes crates/app/src/mtp.rs, crates/app/src/mtp/policy.rs, crates/gpu-deepseek41/src/body/snap.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)
…t's side with them
e7afc96 to
b0b31b1
Compare
There was a problem hiding this comment.
Since the last review: the image-placeholder fix remains present in body38.rs:306. The previous review had no open must-fix or non-blocking items.
Verdict: CLEAN: The import-only rebase resolution preserves the chain symbols and restore validator.
Checked
Duplicates: 0 new definitions in the interdiff. Imported symbols resolve to their existing owners. Dryer reports 0 pairs; gpu and gpu-gates were excluded from its search.
Complexity: All crapper flags are unchanged by this interdiff: slot_file (76), SeqState::take (43), SeqState::put (30), slot_file_off_draft (28), Parked::take (21), drafted_main (20). No function body gained branches.
Silent failure: 0 new sites. The interdiff changes no error handling.
Tests: No new or changed tests. Static mutation check: removing the final-row guard at mtp38.rs:988 makes the existing final-row refusal assertion fail; allowing image placeholders at body38.rs:306 makes the existing saved-history rejection assertion fail. No build or GPU gate was run.
Gates: No thresholds, clauses, tests or lint levels changed; no PIN required.
Adversarial checks: Zero-position and overflowing-row draft reads are rejected before subtraction or access. Restore still validates every current and checkpoint history. The import resolution preserves both chain_spans and check_target_rows; it adds no work to decode or prefill.
Escape catalog: No C1–C4 pattern matches the interdiff.
Notes
GPU evidence remains incomplete: commands contain ... and unresolved inputs, and the reported hashes predate this head. The earlier PTX sameness evidence and image-refusal FAIL-first output remain absent.
Card check: needs-gpu. This pull request changes crates/app/src/mtp.rs, crates/app/src/mtp/policy.rs, crates/gpu-deepseek41/src/body/snap.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.8 서버가
POST /slots/0?action=save|restore에서 501 대신 slot 상태를 파일로 저장하고 복원합니다. 새 프로세스에서 복원해도 이어지는 요청이 저장 없이 이어간 요청과 같습니다.What and why
bloomery-serve-qwen38andbloomery-serveanswered 501 to a slot save or restore on a Qwen3.8 model, so a long conversation could not outlive the process. With--slot-save-path DIRthe seat now writes the state its prompt cache already holds (the body's sequence state and, withBLOOMERY_DRAFT=mtp, the parked MTP draft) as a file, and a restore puts it back through the prompt cache's own resume path. A slot that holds an image is refused, as a snapshot is.A restore reads the whole file before it touches the slot, and refuses a bad file by name with HTTP 400 while the server keeps answering: a short stream, trailing bytes, another model's identity (arch, file, card, ctx), a token id past the vocabulary, an image placeholder in a saved text history, positions past the context, a draft state saved with the draft on put back with it off, and a parked draft whose refresh, last unit or row mapping does not match the restored body.
Release notes: Added: Qwen3.8 slot save and restore (
--slot-save-path DIR), including the MTP draft's state.Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line):crates/gpu-deepseek41/src/body/snap.rsand, as this change needed it, forSeqStateand the MTP draft. They are one owner now,crates/gpu/src/checkpoint/bytes.rs, and the V4.1 snapshot uses it (about 170 lines fewer insnap.rs; its header bytes are unchanged).slot_actionwas copied incrates/gpu-gates/src/bin/gate_qwen38_serve.rsandcrates/gpu-gates/src/bin/gate_ds41_serve.rs; it lives incrates/gpu-gates/src/serve_client.rsand both gates call it.What I ran
Tested head
e7afc962f007d8937a1f8edb308dbef746b7cebfon base9fa4e0036cea9712f683a3443593031429de3bf3.Slot file on a Qwen3.8 fixture file, GB10. The
draftedarm ofgate_qwen38_servestarts its own server (BLOOMERY_DRAFT=mtp,--cache-ram 0, fixed width) and saves, erases and restores slot 0. Command, as thegate-gpu-qwen38-serverecipe runs the drafted arm:Each refusal is followed by a fresh request on the same server with the same ids and
cache_n=0, so the server kept serving. To show the restore checks catch what they are for, I removed one line inserve_seats/drafted.rs(turn_offno longer clears the waiting refresh) and ran the same gate:Real binary, FP4-Local, GB10.
bloomery-servewith the release featuresglm5next,clef,vision,mimo2,solar2,minimaxm3,flint,gemma-embedding2,hf,checkpointon the foldernvidia/Qwen3.8-Flash-Next-FP4-Local(revisionb9ce18a6):One server saved slot 0 after a 36-id prompt and its first answer, a second server in a new process restored it, and the follow-up request was sent to both a server that never saved (the straight run) and the restored one:
The draft proposed 36 tokens and accepted 26 after the restore, so the draft's state came back with the slot. The width chooser picks the draft width from a clock, so the proposal counts differ from run to run on this server; the fixed-width gate above shows
draft_n=45on both sides.Host tests and FAIL-first, x86_64:
Hardware (if the change is for a machine)
Built with
cargo oxide build --arch sm_121a.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.