Skip to content

mm31 oracle: a resume refuses the state of another cut generation - #1118

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-bot-1117
Nov 2, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-bot-1117

Conversation

@juliankang4

@juliankang4 juliankang4 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

MiniMax-M3.1 oracle의 --resume이 다른 cut 세대의 저장 상태를 거부하도록 고쳤습니다.

What and why

Fixes #1117. The oracle writer tools/ref/mm31/dump_tf.py keyed a saved prefill or greedy state on the writer, folder, index, config, model code and torch, but not on the cut's fixture line. A cut regenerated from other layers keeps the same tensors, index and config, so --resume accepted the old state and wrote sets from the wrong cut. The resume identity now carries the fixture line, and both resume paths (prefill and greedy) refuse the state with a named error. The writer changed, so the minimaxm31 build pin moves to the new md5; sets already dumped need a re-dump. The dumper also requires --fixture-line to state every bloomery.fixture.* key of the first shard except the card budget, each once with the shard's value, and refuses a line that leaves a key out or adds one. A partial line such as # fixture<TAB>bloomery.fixture.rev=<REV> would otherwise keep the resume identity equal across a regenerated cut.

Release notes: Fixed: the MiniMax-M3.1 oracle writer no longer resumes a saved state that belongs to another cut of the model.

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), or "none": none.

What I ran

Upstream base 7394839c9b9a613d905eb7cef49205e8d8956576, PR head 6c94f4eb1ea46338c858526242f84da22e9f194c.

The new test Refusals.test_resume_refuses_state_of_another_cut_generation stops a prefill with --until 1, rewrites the first shard's metadata to bloomery.fixture.layers=0,1,3 (tensors, index and config unchanged), and resumes. The resume must be refused.

Before the fix (base dump_tf.py with the new test):

$ python tools/ref/mm31/test_dump_tf.py Refusals.test_resume_refuses_state_of_another_cut_generation
AssertionError: 0 != 65
Ran 1 test in 0.600s
FAILED (failures=1)

After the fix (transformers 5.12.1, torch 2.14.1+cpu, requirements from tools/ref/mm31/requirements.txt):

$ python tools/ref/mm31/test_dump_tf.py Refusals
Ran 14 tests in 0.821s
OK

The refset pin test on the new writer md5:

$ nvidia-smi --query-gpu=name,driver_version,compute_cap --format=csv,noheader
NVIDIA GB10, 595.84, 12.1
$ cargo test -p bloomery-refset --lib minimaxm31
test arch::minimaxm31::tests::the_writer_pin_is_the_source_in_the_tree ... ok
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 307 filtered out; finished in 0.00s

AI help

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

@github-actions github-actions Bot added host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Nov 2, 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: An accepted incomplete fixture line still lets a changed cut reuse saved state.

Must fix

1. Require every cut identity key before trusting the fixture line

tools/ref/mm31/dump_tf.py:1159 adds caller-supplied text to the identity, but fixture_line:1050 checks only the supplied keys. Pass # fixture<TAB>bloomery.fixture.rev=<REV>, pause prefill, regenerate the same folder with different source layers for an already processed layer, and resume with the same argument and unchanged index/config. Both lines pass validation and both identities remain equal. restore:1305 accepts the previous cut's hidden states and taps, mixing saved results with the new cut. Isolated execution of the source functions confirmed acceptance and restoration.

Fixing this before regenerating sets avoids another round of invalid oracle outputs. Insert this immediately before return given[len(prefix):] in fixture_line, add an omitted-key refusal case, and refresh the writer hash pin:

    if set(held) != set(keys) - {FIXTURE_KEY + "card_budget"}:
        raise Refusal("--fixture-line must name every cut identity key except card_budget")

Checked

Duplicates: the new test covers cut identity rather than the existing writer/set refusal cases. Dryer reported 0 pairs.
Complexity: crapper flagged no functions; the production change adds one identity field and changes two messages.
Silent failure: both resume identity checks were followed; an accepted incomplete fixture line leaves them unchanged across a cut change.
Tests: the new test protects dump_tf.py:1159. Its helper recomputes the full fixture line after changing metadata. Removing self.fixture makes the identities equal and defeats its refusal assertion; isolated identity mutation confirmed this.
Gates: BUILD has a dated PIN and reason; its MD5 matches the writer. No tolerance moved.
Escape catalog: C1–C4 do not match. The diff changes tools and reference identity code, with no inference hot path.

Notes

Full dependency-backed tests were not run. The identity/restore behavior, proposed guard, and writer pin were checked in isolation.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

Filed outside this PR: #1121

@juliankang4
juliankang4 force-pushed the dgx-spark-q38-bot-1117 branch from 3c9cfef to 6c94f4e Compare November 2, 2026 01:46

@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: Must-fix 1 is fixed. tools/ref/mm31/dump_tf.py:1051 checks every shard identity key and rejects omitted or additional keys.

Verdict: CLEAN: The interdiff closes the incomplete fixture-line validation defect, with no remaining must-fix finding.

Checked

  • Duplicates: 0 new definitions in the interdiff. Dryer reported 0 pairs.
  • Complexity: crapper flagged no functions. The validation loop now checks the union of expected and supplied keys.
  • Silent failure: 3 refusal paths followed. Invalid fixture lines and mismatched prefill or greedy identities produce a named Refusal, returned as exit 65.
  • Tests: 9 source-defined refusal cases passed in isolation; all 63 incomplete key subsets were rejected. A supplied-key-only mutant at dump_tf.py:1051 accepts both added omission cases. Both resume guards reject a changed cut identity.
  • Gates: BUILD has a dated PIN and reason; its MD5 matches the writer. No tolerance moved. Excluding the card budget matches refset's contract.
  • Escape catalog: C1–C4 do not match. The changes affect oracle tooling and a writer pin; no inference hot path changes.

Notes

The full dependency-backed suite was not run. Validation used isolated production functions, source-defined test cases and mutation checks.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@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 e68409b into midagedev:main Nov 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mm31 oracle: resume identity omits the cut generation

1 participant