Skip to content

placement: a router-rank file puts each layer's hottest experts on the card, the coldest on the expert tier node, the middle on the host (BLOOMERY_EXPERT_RANK; room 128G + one Spark: decode 35 → 49, pp 107 → 211) - #1175

Merged
midagedev merged 3 commits into
mainfrom
coldsplit
Nov 5, 2026

Conversation

@midagedev

@midagedev midagedev commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

플랜 시점의 랭크 파일로 Spark 티어가 각 라우팅 레이어의 가장 차가운 전문가를 든다 — 룸 128G 노드 arm 에서 decode 35 → 49 tok/s, pp 107 → 211 (1 라운드씩).

What and why

Plan (b′) gave an expert tier (the DGX Spark over BLOOMERY_TIER_NODES) each routed layer's next ids after the stage card's prefix, and adaptive residency moves experts between the stage card and the host only, so the tier block held hot experts residency could never take: replayed over the box's V4.1 router sets (prose, code, threads; 50,000 positions each), the id block served 107 node slots a token and held the card to 98 of its 146. This lands one rule and one lever: BLOOMERY_EXPERT_RANK=<router-rank file> (Class C, Kind::Path) makes the stage card each layer's hottest n_l ids, each expert tier the coldest own ids (tier 0 the coldest block), the host the middle (crates/placement/src/placement/rank.rs: ExpertRank::{read, check, split}, refusing by name a file that does not order every routed layer over the model's experts, an id twice or out of range, a layer with fewer ids, and a rank beside an explicit node range); unset, the id order as before. The writer is tools/ref/router-rank.py rank <set>... --out FILE (its --self-test in check-recipes; header # router-rank n_expert=384 n_used=6 sets=prose,code,threads positions=150000). The plan line and the plan record (expert_rank field, schemas refreshed) name the file.

Prediction (docs/cards/node-cold-split.card, [derived]): step = 17 ms card front + 40 × a + node_slots × 0.09 ms, so the node arm's 28.5 ms falls to 22–25 (cross-corpus rank) or ~20.5 (same corpus) → 40–45 tok/s. Measured on the box + Spark, prose P 512, depth 512, n 96, room 128G, one round each in their own lease: the id block 34.39 tok/s mean (p50 34.99, step 28.6 ms, pp 107.4) against the rank file 48.90 (p50 50.32, step 19.9 ms, pp 210.5); host slots a token 36.8 → 45.9. Above the band: the rank was learned on all three sets, which include the prose corpus measured, so the cross-corpus number is still owed. The serve path's tape at the same plan reads 37–41 tok/s (six requests), ~20 % under generate: open, in the user-facing pass.

Release notes: Added — BLOOMERY_EXPERT_RANK: a router-rank file (from tools/ref/router-rank.py) puts each layer's hottest experts on the card, the coldest on an expert tier node and the middle on the host; on a 128 GB room with one DGX Spark, V4.1-Flash decode 35 → 49 tok/s and prefill 107 → 211 (P 512).

Code shape

  • No second copy. One rank owner (ExpertRank); the planner's one list construction changed; SlotMap, HostSet, TierSet take arbitrary lists unchanged (the as_prefix callers are qwen4exp meta tests and the qwen35moe place print, not V4.1).
  • Model code holds only architecture facts. The rule lives in placement; no family branch.
  • Dead code is gone.
  • No silent failure. Every rank refusal by name; a binary that leaves the lever out refuses it set at at_main.
  • Comments state what is true now. tools/check-comments.sh rc 0.
  • No relaxed gate. B10 of gate-gpu-ds41-tier compares the ranked plan with the unranked one within the logits band it already uses (homes differ, bits do not stay equal: gate_deepseek41_step.rs:1013) and holds the ranked tiered plan bit-equal to its T1 reference; measured band max 1.42 / rms 0.22 against pins 16 / 2.5.
  • cargo fmt, clippy on what was touched; just mac-static pending in the union static run.

Duplication found or removed: PlanLevers literal construction at 48 sites gained ..PlanLevers::default(); a constructor would spare the next field (reported, not done here).

What I ran

Box (RTX A6000 + RTX 3090, driver 580), fixture tier, round coldsplit (Sonnet 5.5): placement lib 242 passed (FAIL-first 3 red before the planner change; mutants tier-hottest 2 red, tier-overlap 1 red, missing-layer 1 red); just gate-levers 60 passed; gpu-gates lib 206 passed; just gate-gpu-ds41-tier PASSED (9 clauses; B10 mutant with the lever cut: red "the plan names no rank"); just check rc 0.
Spark A/B (lead): just depth-gpu-ds41 one round per arm, card docs/cards/node-cold-split.card; the ROW lines above.
Union batch (lead, 102215e, tools/gate-batch.sh --ledger --tier fixture --no-canary --list <just affected main>): DONE total=235 red=2 tier=fixture wall=2581s deferred=299. The two: gate-gpu-ds41-tp (OOM on the 24 GB card; main's cc19b0d already pins it to the A6000 and it is green there at that commit, this branch predates it) and gate-gpu-lib (the host::rank::dist stamp test, #1171's known non-deterministic red, plus hw_a_held_card_leaves_the_room_its_open_reads reading a negative room while the other lane freed card memory; neither test's files are in this change); gate-gpu-lib rerun alone: 518 of 519 passed, the held-card room test green, the rank::dist stamp test red again (#1171, not this change).

Hardware

Box: AMD 64-core, 256 GB, RTX A6000 48 GB + RTX 3090 24 GB; DGX Spark (GB10) over TCP as the expert tier node.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X1hsQfyQxXKXsQ6LVTcsx5

…lan time (BLOOMERY_EXPERT_RANK: the stage card the hottest, each expert tier the coldest, the host the middle), its writer tools/ref/router-rank.py, the plan record's field and the tier gate's rank clause

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQfyQxXKXsQ6LVTcsx5
@midagedev midagedev added the needs-gpu Changes code a card must check, and carries no gate run on a card label Nov 5, 2026
@github-actions github-actions Bot added 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 placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Nov 5, 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: MUST_FIX: rank validation accepts unused plans and invalid source traces.

Must fix

1. Check whether the completed plan holds any card experts

crates/placement/src/placement/planner.rs:249: routed.is_some() tests the routing policy, not the placement. With the existing layered(3) fixture, a stage of HEAD bytes and no tiers, ordinary plan(..., &ranked(&orders())) succeeds with every expert on the host. The advertised refusal never runs.
Check the actual counts now, before callers depend on this silent acceptance. Move this check after both fill loops, before row construction:

if let Some(rank) = rank {
    check_rank(
        rank, model, &stacks,
        n_l.iter().chain(tier_n_l.iter().flatten()).any(|&n| n != 0),
    )?;
}

Extend the existing all-host refusal test to call ordinary plan with the same machine.

2. Refuse pooled sets from different model files or builds

tools/ref/router-rank.py:59: two sets with equal expert counts but different header["model"] or header["build"] pass and produce one plausible rank. Missing identities also pass. The base contract requires named identity refusals. Export discards these identities, so validation belongs before pooling.
Insert inside the existing set loop, before the shape check:

        for key in ("model", "build"):
            expected = first["header"].get(key)
            actual = s["header"].get(key)
            if not expected or not actual or actual != expected:
                raise SetError(
                    f"rank: set {name} has {key}={actual!r}; "
                    f"expected {expected!r}, a non-empty shared identity")

3. Reject a token that selects one expert twice

tools/ref/router-rank.py:93: topk=[1,1], one token, top-2 and matching counts is accepted. I reproduced this through the real read_topk and layer_counts functions in memory. The writer exports the corrupt frequencies as a valid rank. Reject it while token and layer context remain available.
Centralize the existing duplicate-token checks from locality and router-residency.Set.ids in router-coverage.read_topk. Insert before return a, remove their duplicate-ID checks, and keep their range checks:

    for t in range(s["tokens"]):
        row = a[t * s["n_used"]:(t + 1) * s["n_used"]]
        if len(set(row)) != s["n_used"]:
            raise SetError(f"{path}: token {t} selects an expert twice")

4. Reuse the prompt walk already added by this PR

crates/gpu-gates/src/bin/gate_deepseek41_tier.rs:1451 duplicates the graph-mode reset, prompt steps and logits collection at crates/gpu-gates/src/bin/gate_deepseek41_tier.rs:585 (R14). Reuse it now so the next prompt-walk change has one owner. Replace union_run's initialization and prompt loop with:

let mut run = rank_run(m, prompt)?;
let mut tok = *run.tokens.last().ok_or("T1: empty prompt")?;

Keep the following graph-node assignment and remaining phases.

5. Remove the unused rank metadata API

crates/placement/src/placement/rank.rs:176: n_expert() and n_used() have no caller outside the new parser test (R13). The stored n_used serves only that getter. Remove these elements before other crates depend on them.
Delete both getter definitions, the n_used: u64 struct field and its initializer entry. Keep the local parse-time validation. Replace the test's header tuple assertion with:

assert_eq!((rank.sets(), rank.positions()), ("prose,code", 100));

Non-blocking

⚠ Exercise the production record path: crates/gpu-gates/src/record.rs:5835 calls with_expert_rank directly. Removing its call from record::plan leaves this test green. Call record::plan with a ranked plan and assert its field; this closes the integration gap with the local fixture.

Checked

Duplicates: both prompt walks confirmed; the fix reuses an existing function and removes code.
Elements: repository-wide call search found only the parser test using the two metadata getters.
Silent failure: in-memory runs through the manifest reader and rank writer accepted different identities, absent identities and duplicate top-k ids.
Tests: the all-host refusal covers only plan_host_routed; the record test calls the helper directly. Rust/GPU gates were not run here.
Gates: no existing bands or pins moved. No escape-catalog pattern applies to these findings.

Notes

Dryer and crapper did not run: their Python modules were missing.
Attach the nvidia-smi line, both commit hashes, model path and gate/A/B command output for the reported GPU results.

Card check: needs-gpu. This pull request changes crates/gpu-flint/src/two_card_tests.rs, crates/gpu-gates/src/bin/bloomery_chat.rs, crates/gpu-gates/src/bin/gate_deepseek41_tier.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)

…k runs on the filled plan's card counts, router-rank.py refuses pooled sets of another model or build or with no identity, a token that selects one expert twice is refused once in read_topk, union_run walks the prompt through rank_run, the unused rank getters are gone; read_rank's asserts are named refusals

Round coldsplitfix (Sonnet 5.5), each with FAIL-first: ordinary `plan` on an all-host machine succeeded with a rank (red
"a rank the plan cannot place was planned" after the move); two sets of different model/build and a set with no
identity pooled; `topk=[1,1]` accepted (now refused in `router-coverage.read_topk`, the copies in locality, predict and
router-residency's Set.ids removed, their range checks kept: residency's sampled check is now every token, ~0.07 s per
200k tokens); the record test now goes through `record::plan` (a mutant without `with_expert_rank` red). Gates:
placement 242, gpu-gates lib 206 (box), gate-gpu-ds41-tier PASSED 9 clauses, the three router self-tests, check-comments,
fmt, mac-check.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X1hsQfyQxXKXsQ6LVTcsx5
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 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 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