Skip to content

gate_qwen4exp_e2e: a flip past an earlier flip is capped with the earlier flips undone - #955

Closed
midagedev wants to merge 35 commits into
mainfrom
q4eflip-pr
Closed

midagedev wants to merge 35 commits into
mainfrom
q4eflip-pr

Conversation

@midagedev

Copy link
Copy Markdown
Owner

What and why

gate-gpu-qwen4exp-e2e@q38dense has been red on main since the BF16 residual streams (b825b64). The walk is not
wrong. The gate held a flip that comes after an earlier flip on its path to a cap derived for a chain that takes ik's
experts. Past an earlier flip our error also carries that flip's cascade, a term of the weights. Flip::allowed_past
(PIN(2026-10-29)) keeps the rule gap ≤ err and applies the cap to the same pair's error in the forced arm, which is
the same walk with ik's routes planted, so it carries the rounding alone. A second commit corrects two comments: the
BF16 streams are ours, and ik and mainline keep F32 tensors.

Release notes: internal — a gate rule re-derived for flips that follow an earlier flip; no engine change.

Code shape

  • No second copy. The rule lives in flip.rs, beside Flip::allowed.
  • Model code holds only architecture facts.
  • Dead code is gone.
  • No silent failure. A row too short for a pair's id reads NaN and fails.
  • Comments state what is true now.
  • No relaxed gate. This is a re-pin with PIN(2026-10-29):, a derivation and FAIL-first (below). The card leg keeps the old rule.
  • cargo fmt and cargo clippy are clean.

Duplication found or removed: none.

What I ran

Derivation, all [derived]: after a flip, err = rounding + cascade. Predicted 6·rms·√(band² + n·δ_c²) for layers 1/2/3 is [0.13, 0.23] / [0.14, 0.28] / [0.16, 0.34]. Measured 0.155 / 0.155 / 0.154, all inside. The no-flip cap is 0.11-0.14.

Green (fixture tier): q38dense 14 flip(s) … 14 allowed … PASS; default 7 … 7 allowed … PASS; q38glue 7 … 7 allowed … PASS; gates-lib 192 passed; 0 failed.

FAIL-first:

  • A router mutant (layer 2 reads the wrong input) gives 16 flip(s) … 11 allowed … FAIL. Every layer-2 flip prints undone past the pinned frontier.
  • A cap mutant fails the unit test (f.allowed_past(0.1, …)).

Built on #953 and the agent-start PR; its own commits are the last 2.

🤖 Generated with Claude Code

midagedev and others added 30 commits October 29, 2026 14:58
Sites35 gains its own dense feed-forward list (the projections' types and NVFP4); NVFP4 stays out
of the attention and delta-rule projections. HEAD_TY takes NVFP4. The q8_1 quantize before a down
or shared down runs where the site's gemv reads q8_1 (reads_q8_1, one owner for the four sites and
the MTP pack), not where the type is a K-quant: an NVFP4 down no longer reads a stale act_h. The
coverage pins and hf-arch-check's mirror take the new list; Metal's lists keep what they admitted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the card through Body35, and the qwen3 seat serves it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and oracle sets, and the dense gate's G3/G4 clauses

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_folder; the recipe builds with checkpoint

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fixture tier requires of a folder

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t and holds each side's weights under it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le's row, not from the tier's architecture lookup

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s layer

Mainline's converter writes ModelOpt's activation scale beside each NVFP4 weight. The load
quantizes activations from their own blocks and never reads it, as the folder map lists it
unread. One beside a tensor of another type is still refused by name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… folder's table as stored

The folder open keeps a BF16 matrix as stored; the embedding gather now takes it through q38's
embed_rows_bf16, which the body already loads, so no kernel is added.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nsor is the folder map's bytes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion gives

file_format turns a BF16 tensor into Bf16AsF32, while the model's description
(ModelTensors::card_format, which the plan and the whole-fit verdict size) can
keep it as BF16 words. Weights::load and PartsLoad::load_whole now take the
description's format and fall back to the type's own where it gives none.
Body35 passes its description's formats; the other bodies pass none, so
their bytes are unchanged. Host-only load path; no kernel or launch moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… derived term

The oracle's floor on the 4-layer NVFP4 twin (mainline CPU against CUDA,
0.001-0.003) holds no term for our activation rule (q8 per 128 on NVFP4
gemvs, f32 on Q8_0) against mainline's q8 per 32. A host simulation on
mainline's own activations derives that term: 0.0049 median from the head,
FFN and output sites, up to 0.0109 with the q/k/v inputs at gain one.
Each band is that PIN in quadrature with the floor's term. Measured 0.0053
and 0.0049 medians sit inside the derivation. FAIL-first: blk.0.ffn_down's
scale set to 1.0 reads median 0.44, FAIL; clean PASS. G4 is 0 lanes on both
sets, and the same dropped-scale mutant on the twin path turns it red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
clippy's type_complexity flagged the tuple parameter of load_blocks_from.
One alias in weights.rs owns the type; model.rs and parts.rs use it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Class names a card's weight-format order

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…SON events, one exit table, --help exits 0

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ry-run, --json, the early listener and typed refusals (agentserve R4)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… matches the refusal without Debug

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e model pair and probe answers take named types

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…md, llms.txt and the catalog-docs check (agentserve R5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…able; the online pick survives a short range and a missing repo

The dry run's start replays the pick by --model NAME:VARIANT (pinned revision). A refusal after
the bind prints bound, then its error event, with its named code; --help exits 0 on stdout; cpu_gate
exits 69 with an error event. sparse_set creates its directory, a range read leaves room for the
hub's redirect body, and a 404 listing rejects its rows instead of ending --recommend.
The gates that pinned the old contract are re-pinned with FAIL-first (PIN 2026-10-29).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st held, reads a set's files in parallel, and keeps a pinned revision's headers

An uncached dry run of qwen3.8-flash-next took 87.3 s, 81.4 s of it in 53
serial header range reads, mostly of rows that could not win on this machine.
- catalog::pick skips a row whose ceiling tier cannot beat the best tier held:
  no listing, header or probe. Such a row reads `ranked-below`.
- remote reads up to 8 files of a set at once and answers them in order.
- a header read whole at a commit-pinned revision is not read again.
Probes stay serial (each child counts its siblings' contexts).
Measured on the box: dry run 87.3 s -> 8.19 s cold, 1.77 s warm;
--recommend 210.7 s -> 67.6 s cold, 8.48 s warm.

The test a_probe_that_answers_the_wrong_number_of_rows_is_refused and
CatalogError::ProbeAnswers are removed (2026-10-29): a probe now answers one
row per call, so a count mismatch cannot be expressed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and refusal keeps the exit table

- A start by name serves under the catalog name it was asked by (an implicit
  --alias); a user's --alias, -a or LLAMA_ARG_ALIAS wins. A file's general.name
  ("Hf" on NVIDIA's Nemotron GGUF) no longer names it.
- seat_bin is the stand-alone seat binaries' one main: events, usage checks,
  the driver probe (69), --list-devices, placement, run, exit. bloomery-serve-ds41
  and -qwen38 now refuse with an error event and the class's code;
  serve_preflight drops its branch on the binary (PIN re-written).
- An --embd-model file of an unsupported architecture is Unsupported (65) in
  every seat (side_seat/flags.rs), and a start by name whose rows all refuse
  in one class ends in that class.
- A model whose rows are all unverified ends usage (64), says so, and names
  each row's --model NAME:VARIANT in `next`.
Each change has a test that was red on its mutant first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and the first call's time, codes 64 and 65, the seat binaries

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…require

A build of generate_ds41 (gpu, deepseek41, no hf) failed: seat_bin names
side_seat::Flags, which exists only with hf.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… model_file's fetch

The start by name and its pick read $BLOOMERY_CACHE, $HOME and
$BLOOMERY_REF_MODEL in place again (check-levers); they now call
model_file::cache_root and model_file::ref_model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the docs check reads a continued string

The 64 and 65 rows gained the cases the start by name refuses with them. The
docs check now reads a Rust string's line continuation as its value; before,
it missed the 65 row (the tree's own case in its self-test was red).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
midagedev and others added 5 commits October 29, 2026 14:59
…ation read; the orphan self-test counts gate-ds41-bind's start:: run

check-catalog-docs.py reads crates/serve/src/exit.rs as data. Its Display impl is for a type a macro writes, so item
reach places it whenever its file is linked, and bloomery-serve became an active owner of the smoke key with no
compiled files (KeyError). key_files now takes active owners only among the linked packages; the file stays a key
input as the script's read. A reach self-test case with a macro-written type in an unlinked package holds both.
The orphan FAIL-first (a) counts the start:: tests the recipe now also runs, and its anchors name each filter
whether or not it is the recipe's last command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…with the earlier flips undone

The pair rule's cap is derived for a chain that takes ik's experts. Past an earlier flip our error also carries
that flip's cascade, a term of the weights no rounding model bounds. Flip::allowed_past (PIN(2026-10-29)) keeps
gap <= err and holds the cap to the same pair's error in the forced arm's router row, the same walk with ik's
routes planted, so the rounding alone. The card leg keeps the old rule (it has no undone walk).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset 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 serve The HTTP server: crates/serve tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Oct 29, 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 PR's own two commits (Flip::allowed_past and its wiring in judge_flips) fail closed on every input I built, and their test turns red on each mutant I planted.

Non-blocking

⚠ The cascade error past a flip is no longer bounded by the gate: crates/gpu-gates/src/flip.rs:143 keeps gap <= err but drops err <= cap. The PR body derives a frontier of [0.13, 0.34] [derived] for that error; no code applies it. A top-k pick bug at a layer past an earlier flip passes when its gap is within the cascade error, and the undone row cannot show it (the forced arm plants the picks). Question for the author: is a pick bug there caught by another clause? If not, add err <= 6·rms·√(band² + n·δ_c²) or name why it is not needed. The FAIL-first in the body covers a router-input mutant only.

⚠ The wiring has no unit test: crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs:2673 picks the rows with row(u, f.token, f.layer). Swapping token and layer, or .filter(|_| prior) to !prior, is caught only by the fixture-tier gate run. The body shows that run green and for one mutant; it does not show these two.

also 1 minor: the module doc of flip.rs (lines 7-12) still says every flip is capped on its error; allowed_past is the exception.

Checked

  • Duplicates: 4 new items checked (allowed_past, line_past, errs_in, row); the only hit is a two-line v closure copy in flip.rs, cheaper than a new owner. Dryer pairs read: catalog.rs:340 ~ listener.rs:33 and the rest share a shape (name() match arms), not knowledge.
  • Complexity: crapper flagged only functions in the stacked commits (bloomery_serve::drive::run 36→66, gate_serve_start::Gate::by_name new 36). Not reviewed (see Notes). judge_flips is not flagged.
  • Silent failure: 3 sites followed. A row too short reads NaN in errs_in, held <= cap is false, allowed_past is false, and line_past prints the "past the pinned frontier" verdict. A missing token or layer in row gives an empty row and the same result.
  • Tests: a_flip_past_another_is_capped_with_it_undone protects flip.rs:149. Cap read on err: the rounding assertion turns red. Gap test dropped: the wrong assertion turns red. held <= cap flipped to >: the rounding assertion turns red. NaN passing: the rounding[..1] assertion turns red.
  • Gates: one re-pin, PIN(2026-10-29) with derivation and FAIL-first in the body. The card leg passes None and keeps the old rule (documented at lines 3712-3716).
  • Escape catalog: no C1 to C4 pattern in added shell or justfile lines I grepped.

Notes

  • The diff holds about 15,000 added lines. The body says the PR is built on #953 and an agent-start PR, with its own commits last. I reviewed the two own commits in full. I only grepped the stacked part for silent-failure and shell patterns; the let _ = hits there are stdio writes and temp-dir cleanup. Review those under their own PRs.
  • No nvidia-smi line, no commit hashes and no just gate-* output in the body: gpu.json evidence is false.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/bin/bloomery_serve_ds41.rs, crates/gpu-gates/src/bin/bloomery_serve_qwen38.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)

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 host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset 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 serve The HTTP server: crates/serve tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant