Skip to content

model: MiniMax-M3's model side and seven lifts to common owners; the lint ratchet back at 33 - #526

Merged
midagedev merged 3 commits into
mainfrom
mm3r1b
Oct 20, 2026
Merged

midagedev merged 3 commits into
mainfrom
mm3r1b

Conversation

@midagedev

Copy link
Copy Markdown
Owner

MiniMax-M3 R1, the model side.

  • crates/model/src/arch/minimaxm3/ holds the registry keys, names, roles, spec and KV layout. The MSA values and the dense/sparse split are read from the file.
  • The registry row has no fixture and no plan yet; R6a brings the body.
  • Seven verbatim moves to common owners, with their refusal texts kept: arch/names.rs, classify.rs (model_level_role, block_stem), arch/mod.rs (expert_counts, refuse_tensor_set, plain_rope, dims_agree), runtime/stores.rs (kv_plane_bytes).
  • model-tax grows by 6 lines. All six are MiniMax arms that an exhaustive match forces. MK1b removes them next.

A second commit fixes clippy chunks_exact_to_as_chunks at crates/gpu/src/mxfp4_sel.rs:1190. fda5eca brought the lint to 34 against a ratchet of 33.

Gates (box, tools/gate-batch.sh --ledger):

  • At 821d7b8, the round's --round-ledger batch ran 188 of 188 green. Its narrow-scan was identical on 3 bins: no kernel moved.
  • R1 was then rebased onto fda5eca. The 8 newer commits share no file with it.
  • On this tree, the interaction set ran: every touched crate's lib gate, the meta and host gates of every lifted family, gate-placement, gate-glm5next-hf-map, and the nemotron, qwen3moe, qwen35moe and glm5next e2e.
    • Fixture tier: 20 green, 6 deferred.
    • Real tier: those 6 green.
  • Reason for not rerunning everything, 2026-10-20: the rest were green at the old base with no shared file. The full list runs in the release batch.
  • just check-model-tax: ok. The box bloomery-model --lib arch::: 336 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq

@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 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 labels Oct 20, 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: the new reader accepts missing model-level tensors and adds duplicate tensor-name owners.

Must fix

1. Reject missing model-level tensors through the existing validator

crates/model/src/arch/minimaxm3/hparams.rs:251
Kind A: an otherwise valid header missing token_embd.weight, output_norm.weight or output.weight passes Hparams::read. This loop checks only layer tensors; dims_agree filters absent tensors and classification visits only present ones. Consequently, spec.rs:26 returns an incomplete Read instead of a named tensor error.
Reuse hybrid.rs:317, which already checks the model-level names. This fixes the reader's omission and removes its copied validation loop before another caller depends on it (R14).
Replace the method below. Remove its unused required and refuse_tensor_set imports and the required re-export in roles.rs. Add missing-global cases to the tensor-refusal test.

fn tensors_agree(&self, split: &Split) -> Result<(), PlacementError> {
    let kinds: Vec<_> = (0..self.n_layer).map(|l| self.kind(l)).collect();
    crate::arch::hybrid::layers_agree(
        split,
        &kinds,
        |kind| match kind {
            Kind::Dense => vec![ATTENTION, DENSE],
            Kind::Sparse => vec![ATTENTION, ROUTED, INDEXER],
        },
        &[Kind::Dense, Kind::Sparse],
    )
}

2. Give the seven new name helpers common owners

crates/model/src/arch/minimaxm3/names.rs:13 duplicates all four indexer helpers in qwen35moe/names.rs:99.
The three new ffn_*_shexp helpers in arch/names.rs:132 also repeat qwen35moe/names.rs:129, plus DeepSeek2, DeepSeek41 and GLM5Next.
Kind B (R14): these functions own identical strings, regardless of tensor dtype or attention algorithm. Consolidating them now avoids maintaining more copies as callers are added.

Add these four definitions to arch/names.rs:

/// A layer's index-query projection name.
#[must_use]
pub fn indexer_q_proj(l: usize) -> String {
    blk(l, "indexer.q_proj.weight")
}

/// A layer's index-key projection name.
#[must_use]
pub fn indexer_k_proj(l: usize) -> String {
    blk(l, "indexer.k_proj.weight")
}

/// A layer's index-query normalization gain name.
#[must_use]
pub fn indexer_q_norm(l: usize) -> String {
    blk(l, "indexer.q_norm.weight")
}

/// A layer's index-key normalization gain name.
#[must_use]
pub fn indexer_k_norm(l: usize) -> String {
    blk(l, "indexer.k_norm.weight")
}

Remove the now-unused blk import from minimaxm3/names.rs. Replace the four indexer definitions in minimaxm3/names.rs and qwen35moe/names.rs with:

pub use crate::arch::names::{
    indexer_k_norm, indexer_k_proj, indexer_q_norm, indexer_q_proj,
};

Replace the three shared-expert definitions in deepseek2, deepseek41, glm5next and qwen35moe name modules with:

pub use crate::arch::names::{ffn_down_shexp, ffn_gate_shexp, ffn_up_shexp};

Also replace indexer_k_norm in the DeepSeek41 and GLM5Next name modules with:

pub use crate::arch::names::indexer_k_norm;

This removes more definitions than it adds.

Checked

Duplicates: 124 added declarations searched; seven new spelling copies and the validation copy above. Eight dryer pairs read: short adapters or lookups over separate architecture tables; no additional finding.
Complexity: new Hparams::read (23) validates attention and expert/indexer metadata; new spec_of (24) constructs attention and FFN descriptions. Their natural boundaries are those stages. Need::fmt +2 and needs +1 are exhaustive arms.
Silent failure: eight sites followed. Malformed block names reach the unclassified-tensor error; dense width is established before use; six ignored results are test-file cleanup.
Tests: 24 new tests and one changed GPU test inspected for assertion-killing mutants: wrong bounds, roles, shapes, refusals, activation, cache sizes and missing index stores turn assertions red. Dropped alignment checks at mxfp4_sel.rs:850–851,922 fail the changed test. Missing model-level tensors remain untested (#1). Mutation reasoning only; tests were not executed.
Gates: four model-tax pins added with dated reasons; no existing tolerance or case removed.
Escape catalog: C1–C4 do not match. No decode/prefill work or kernel body changed.

Notes

No FAIL-first output accompanies the new tests.

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

@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.

Since the last review:

Verdict: CLEAN: Both earlier findings are fixed, and no new must-fix defect survives the incremental review.

Checked

Duplicates: four added function definitions searched. All seven consolidated names have one definition each. Eight dryer pairs read: unchanged adapters and lookups over separate architecture tables; no additional finding.

Complexity: crapper's Hparams::read (23), spec_of (24), Need::fmt (88) and needs (55) are unchanged in this increment. Their previously reviewed growth is metadata validation, description construction and exhaustive match arms.

Silent failure: zero added suppression/default sites. Both common-validator error branches propagate named tensor errors through Hparams::read to spec::read.

Tests: two changed tests checked by mutation reasoning. Skipping layers_agree at hparams.rs:253 fails the missing-global cases. Swapping indexer stems at names.rs:151/157 fails the shared-name assertions. Rust tests were not executed.

Gates: no pins moved. The removed local indexer-name assertions remain in the expanded common test.

Adversarial checks: missing globals and misplaced dense/sparse tensors produce named errors. Set comparison confirms all 11 dense and 20 sparse requirements and their banned stems are preserved; shared stems remain allowed when every layer is sparse.

Escape catalog: C1–C4 do not match. This increment changes load-time validation and names; no decode, prefill or kernel work changes.

Notes

The body summarizes gate results but supplies neither FAIL-first output nor the complete card evidence list: card/driver, both full commit hashes, model file, commands and output.

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

@midagedev
midagedev enabled auto-merge (rebase) October 20, 2026 08:11
midagedev and others added 3 commits October 20, 2026 17:59
…t) and seven lifts it shares with the families

The minimaxm3 family reads its registry keys, tensor names, roles, spec and KvLayout from the file. The MSA values and
the dense/sparse split come from the keys and tensors, never constants. The registry row has no fixture and no plan:
R6a brings the body.

Seven verbatim moves to common owners, each with the families that call it (refusal texts kept):
- arch/names.rs: 19 common names; qwen3moe and mimo2 re-export them.
- arch/classify.rs: model_level_role and block_stem (qwen3moe, mimo2, glm5next).
- arch/mod.rs: expert_counts, refuse_tensor_set, plain_rope, dims_agree (from hybrid.rs).
- runtime/stores.rs: kv_plane_bytes (qwen3moe, qwen35moe).

models gains Arch::MiniMaxM3, Act::SwigluOai and Selector::BlockMax (Need::BlockMax, Need::SwigluOai). A BlockMax GQA
layer holds an IndexKeys store. model-tax grows 6 lines, all MiniMax arms an exhaustive match forces; MK1b removes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq
…(clippy chunks_exact_to_as_chunks)

The lint ratchet is 33; fda5eca added the 34th warning at mxfp4_sel.rs:1190.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq
…xer and shexp names have one owner

- minimaxm3's tensors_agree calls hybrid::layers_agree, so a file without token_embd, output_norm or output is a
  named error. The copied per-layer loop and its imports are gone.
- arch/names.rs owns indexer_{q_proj,k_proj,q_norm,k_norm} and the shexp names. deepseek2, deepseek41, glm5next,
  qwen35moe and minimaxm3 re-export them, and the spelling table pins them once (22 rows).

FAIL-first: with the model-level loop off, no-embd, no-final-norm and no-head read the file
("token_embd.weight: is not in the file" expected); with indexer_q_proj spelled as k_proj, the table's row fails.
Fixture batches over the reach union and the model crate's own gates: DONE total=121 red=0 and total=15 red=0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq

@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.

Since the last review:

Verdict: CLEAN: The context-only rebase preserves the GPU test's input and stream lifetime.

Checked

Duplicates: zero new items in this interdiff. The eight dryer pairs belong to unchanged patches already covered by the previous review.

Complexity: crapper's Hparams::read (23), spec_of (24), Need::fmt (88) and needs (55) are unchanged here. Their previously reviewed growth is metadata validation, description construction and exhaustive match arms.

Silent failure: zero new suppression sites. The discarded chunk remainder is empty: the fixture has exactly eight blocks of 17 bytes.

Tests: crates/gpu/src/mxfp4_sel.rs:1663 initializes the same bytes as the base. Mutation reasoning: removing the production alignment check at line 888 loses the required gate.qs refusal and fails the test. GPU tests were not executed.

Gates: no pins, assertions or cases changed.

Adversarial checks: tail loss is blocked by the exact block multiple. Every scale byte remains 127. The rebased upload takes &CudaStream, returned by Gpu::stream(); the GPU outlives all launches. Only test setup changes; decode, prefill and kernel work are unchanged.

Escape catalog: C1–C4 do not match.

Notes

The PR body summarizes gates but lacks the complete card evidence: card/driver line, both full commit hashes, model file, commands and output.

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

@midagedev
midagedev merged commit d322507 into main Oct 20, 2026
6 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 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