Skip to content

lfm3: the model description, the reader, and the mainline oracle (LFM3-1.7B, C0 + C4) - #924

Merged
midagedev merged 5 commits into
mainfrom
lfm3-land
Oct 28, 2026
Merged

midagedev merged 5 commits into
mainfrom
lfm3-land

Conversation

@midagedev

@midagedev midagedev commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

This is the first landing for LiquidAI's LFM3-1.7B. The model is now read and described. No engine runs it yet.

  • Description (crates/models): Arch::Lfm3, Mixer::ShortConv{taps}, Residual::Sandwich{eps, add}, OutGate::ProjHead and Rope.factors (rope_freqs.weight as ggml's freq_factors).
    • program_of(Lfm3) is None.
    • Every site that cannot run a new variant refuses it by name. This includes two that would otherwise have run it silently: Metal's ungated ProjHead and glm5next's ShortConv fall-through.
  • Reader (crates/model/src/arch/lfm3): it reads the layer pattern (13 short-conv, 5 sliding-256, 6 full), the conv width and the rope table, and refuses a wrong one by name. gate-lfm3-meta checks it.
  • Oracle:
    • llama.cpp mainline at 19cce6919 (#31252), built with the existing pinned-commit builder.
    • Three refset families (Q4_K_M, Q8_0, BF16 at HF revision b3f2ae5d), dumped on the box.
    • nemotron_ref.cpp gains an lfm3 arm.
  • Tokenizer: the lfm2 pre-tokenizer alias and a chat template render fixture.

Proof (fixture-tier landing batch, together with #925):

  • 235 items. 233 green. gate-gpu-ds41-step went green on a rerun alone; its first run lost its binary to a parallel rebuild. gate-gpu-qwen38-serve is red on main too: an adaptive-residency reset returns 501.
  • gate-refset (real tier) is green.
  • refset-check gives 399 PASS, the LFM3 sets and the nemotron sets after the nemotron_ref.cpp change included.
  • The second-Mac static tier: combos have 0 red, fmt and lint are clean.

Next: C1 (common host owners: the conv ring's length, rope factors, the host twins), then the kernels and the body.

This was written with AI help (Claude) and reviewed by the maintainer's lead session.

🤖 Generated with Claude Code

midagedev and others added 3 commits October 28, 2026 23:49
…d, Rope.factors), the reader and gate-lfm3-meta

LFM3-1.7B's GGUF reads into the shared description: Mixer::ShortConv{taps}, Residual::Sandwich{eps, add},
OutGate::ProjHead and Rope.factors (rope_freqs.weight as ggml's freq_factors). No engine runs it yet
(program_of(Lfm3) is None); every site that cannot run a new variant refuses it by name, including the two that
would have run it silently (Metal's ungated ProjHead, glm5next's ShortConv fall-through). The tokenizer gains the
lfm2 pre-tokenizer alias and the chat template its render fixture.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mp and fetch recipes

crates/refset/src/arch/lfm3 holds three logits families (Q4_K_M, Q8_0, BF16 of LFM3-1.7B at b3f2ae5d), pinned to
the 19cce6919 build's llama-tokenize and libllama.so md5s. build-lfm3-lcpp builds the tree through the existing
pinned-commit builder (tools/ref/qvis/build-lcpp-qvis.sh); nemotron_ref.cpp and dump-nemotron.sh gain an lfm3 arm.
All three sets were dumped on the box and pass refset-check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 28, 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: one pinned gate string in qwen4exp_meta.rs changed without a dated PIN; the rest of the change is correct for what it claims (no program runs LFM3 yet).

Must fix

1. The VIEW pin of qwen4exp_meta.rs moved without a PIN

crates/model/tests/qwen4exp_meta.rs:39 now expects yarn: None, factors: false inside the TokenPool rope. Rope gained a field and its derived Debug prints it, so the old string no longer matches. The value did not change, but a gate string moved, and this file records every such move with a dated reason (line 26 and line 34 are the same kind: "the values are the same"). Cost: the next reader of the diff cannot tell this edit from a loosened pin.
Fix: add above that line

    // PIN(2026-10-28): `factors: false` joined the nested `Rope`'s Debug text (`Rope.factors` was added for LFM3); the values are the same.

Non-blocking

⚠ New refusals have no test: metal/src/instance.rs:449 (ProjHead, factors), gpu/src/arch/qwen3moe/plan38.rs:462, gpu/src/attention_h128.rs:147, model/src/arch/mimo2/program.rs:93. Mutant: delete !r.factors or OutGate::ProjHead at any of them; no assertion turns red (only chain got a misfit row). The PR names these refusals as a goal. Direction: in the Metal test a_layer_the_kernels_read_otherwise_is_refused_by_name (line 1004), loop the existing Proj case over [OutGate::Proj, OutGate::ProjHead], and add one case with factors: true; add one misfit row each in the mimo2 and plan38 tables.

⚠ Rope table key ignores factors: model/src/arch/lfm3/place.rs:122 keys the distinct ropes by (base, dims). A file with rope.freq_base == rope.freq_base_swa and rope_freqs.weight needs two tables (full layers divide by the factors, sliding layers do not), but rope_row counts one: stage_position_bytes is short by dims × 4 B per position (512 B × 262,144 = 128 MiB at LFM3-1.7B's shape [derived]). The reader accepts such a file (hparams.rs does not require the two bases to differ). Add g.rope.factors to the key tuple. No plan reads this yet, so it is not blocking.

Checked

  • Duplicates: about 45 new items (fns, types, consts, scripts) checked. Dryer's 3 pairs read: Inputs::runnable/unimplemented is the 7th copy of an existing per-family idiom (hybrid.rs:525, place_hybrid.rs:465, and others), and lfm3::spec::read has the shape of nemotron_h::spec::read over different hparams. A shared owner would touch six families and is its own piece of work. The three model*() fns in refset/arch/lfm3 follow the same per-family pattern. No finding.
  • Complexity: Hparams::read 30 (new, a straight list of key reads, no nesting); needs and Need::fmt +4 (even match arms); the rest +1 (one arm).
  • Silent failure: 11 consumer sites of the new Mixer, OutGate, Residual and Rope.factors followed, all refuse by name or are exhaustive matches; 6 reader sites (layer_kinds, rope_factors, rope_dims, check_kv, roles::require, dims_agree) refuse by name. program_of(Lfm3) is None, so coverage lists the file as unimplemented.
  • Tests: mutants tried on the new tests: conv ring taps - 1 → taps (red in state.rs), digits 3 → 1 (red in pixtral_hf_cases), lfm2 row removed (red), !g.rope.factors dropped in chain gqa_class (red), sandwich or factors emission dropped (red in the_lfm3_parts_need_their_rows). Not covered: see ⚠ 1.
  • Gates: one pin moved (qwen4exp_meta.rs, must-fix 1). The model-tax.tsv rows carry dated PINs.
  • Escape catalog: C1 to C4 checked in the 5 new or changed scripts (set -euo pipefail, quoted <<'PY', no pgrep, no self-named function); none matched.
  • Performance: no hot path touched (description, reader, load-time guards, tools).

Notes

  • No nvidia-smi line or both-commit gate output in the PR body; the body reports a fixture-tier batch only.

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

"[0,2,4-6,8-10,12-14,16-18,20-22,24-26,28-30,32-34,36-38,40-42,44-46] delta Gdn { khead_map: Tiled, gate: Sigmoid } k 16 v 48 d 128 conv 4 || moe 512/10 ff 640 swiglu None Softmax bias false norm true x1 hash false shared 640 swiglu None gate true || hc",
"[1] delta Gdn { khead_map: Tiled, gate: Sigmoid } k 16 v 48 d 128 conv 4 || moe 512/10 ff 640 swiglu None Softmax bias false norm true x1 hash false shared 640 swiglu None gate true || hc [Ple]",
"[3,7,11,15,19,23,27,31,35,39,43,47] gqa 24/2 x 256 rope Imrope { sections: [11, 11, 10, 0] } 64 base 10000000 yarn - qk_norm true out_gate Packed | TokenPool { heads: 4, d: 128, top_k: 2048, pool: 4, rule: Mean { rope: Rope { mode: Imrope { sections: [11, 11, 10, 0] }, dims: 64, base: 10000000.0, yarn: None } } } || moe 512/10 ff 640 swiglu None Softmax bias false norm true x1 hash false shared 640 swiglu None gate true || hc",
"[3,7,11,15,19,23,27,31,35,39,43,47] gqa 24/2 x 256 rope Imrope { sections: [11, 11, 10, 0] } 64 base 10000000 yarn - qk_norm true out_gate Packed | TokenPool { heads: 4, d: 128, top_k: 2048, pool: 4, rule: Mean { rope: Rope { mode: Imrope { sections: [11, 11, 10, 0] }, dims: 64, base: 10000000.0, yarn: None, factors: false } } } || moe 512/10 ff 640 swiglu None Softmax bias false norm true x1 hash false shared 640 swiglu None gate true || hc",

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.

A pinned gate string moved (Rope Debug gained factors); this file dates every such move.

Suggested change
"[3,7,11,15,19,23,27,31,35,39,43,47] gqa 24/2 x 256 rope Imrope { sections: [11, 11, 10, 0] } 64 base 10000000 yarn - qk_norm true out_gate Packed | TokenPool { heads: 4, d: 128, top_k: 2048, pool: 4, rule: Mean { rope: Rope { mode: Imrope { sections: [11, 11, 10, 0] }, dims: 64, base: 10000000.0, yarn: None, factors: false } } } || moe 512/10 ff 640 swiglu None Softmax bias false norm true x1 hash false shared 640 swiglu None gate true || hc",
// PIN(2026-10-28): `factors: false` joined the nested `Rope`'s Debug text (`Rope.factors` was added for LFM3); the values are the same.
"[3,7,11,15,19,23,27,31,35,39,43,47] gqa 24/2 x 256 rope Imrope { sections: [11, 11, 10, 0] } 64 base 10000000 yarn - qk_norm true out_gate Packed | TokenPool { heads: 4, d: 128, top_k: 2048, pool: 4, rule: Mean { rope: Rope { mode: Imrope { sections: [11, 11, 10, 0] }, dims: 64, base: 10000000.0, yarn: None, factors: false } } } || moe 512/10 ff 640 swiglu None Softmax bias false norm true x1 hash false shared 640 swiglu None gate true || hc",

…(clippy redundant_clone)

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

@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 pin in qwen4exp_meta.rs from the last review is still open; the one new commit is a safe cleanup.

Since the last review:

Must fix

1. The VIEW pin of qwen4exp_meta.rs moved without a PIN

crates/model/tests/qwen4exp_meta.rs:39 expects factors: false inside the TokenPool rope. Rope gained a field and its derived Debug prints it. The value did not change, but a gate string moved. Lines 26 and 34 of this file record the same kind of move with a dated reason. Cost: a reader of the diff cannot tell this edit from a loosened pin.
Fix: add this line directly above line 39:

    // PIN(2026-10-28): `factors: false` joined the nested `Rope`'s Debug text (`Rope.factors` was added for LFM3); the values are the same.

Checked

  • Duplicates: the new commit adds no item. Nothing new to check.
  • Complexity: no function in the new commit changed in complexity.
  • Silent failure: no new site. The commit removes a .clone() in a test.
  • Tests: the new commit changes each_kind_holds_its_own_bytes (place.rs:231). with_rows takes self (line 150) and kv is not used after that line, so the move compiles. The assertions are the same, so the mutants from the last review still turn red.
  • Gates: no pin moved in the new commit; the open pin is must-fix 1.
  • Escape catalog: no script in the new commit; none matched.
  • Performance: no hot path touched.

Notes

  • No nvidia-smi line or both-commit gate output in the PR body; it reports a fixture-tier batch only.

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

…a's VIEW pin names the factors field

The rope table key now carries `Rope.factors`, so full layers that divide by the
factors and sliding layers that do not stay two tables when the file gives both
one base. The new test is red with the key without factors.

qwen4exp_meta's TokenPool line moved with `Rope`'s Debug text; its PIN says so.

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

@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 earlier must-fix is fixed, and the new commit adds a test that turns red on the mutant it names.

Since the last review:

  • Must-fix 1 (VIEW pin moved without a PIN): fixed. crates/model/tests/qwen4exp_meta.rs:39 now has a dated PIN(2026-10-28) line with the reason.
  • ⚠ 2 (rope table key ignores factors): fixed. The key is now (base, dims, factors) at place.rs:122, with a test.

Non-blocking

⚠ The rope_row doc names the old key: place.rs:86 says "each distinct rope (base and dims)". The key now holds factors too. Change it to "(base, dims and factors)".

Checked

  • Duplicates: the commit adds one test and no production item. Nothing new to check. The three dryer pairs are from the earlier full review and are not on lines this commit adds.
  • Complexity: no function in the commit changed in complexity.
  • Silent failure: no new site. The new test uses expect on both lookups.
  • Tests: factors_keep_a_rope_of_the_same_base_a_table_of_its_own protects the key at place.rs:122. Mutant: the key drops factors. The test sets every GQA base to the full layers' base, so the full layers (factors true, spec.rs:93) and the sliding layers (factors false) differ only by factors. The mutant counts one table and stage_position_bytes(10) gives HEAD*4*10, not 2*HEAD*4*10, so the assertion turns red.
  • Gates: one pin added (qwen4exp_meta.rs:39) with a date and reason; no value moved.
  • Escape catalog: no script in the commit; none matched.
  • Performance: no hot path touched; of_spec runs at placement time.

Notes

  • No nvidia-smi line or both-commit gate output in the PR body; it reports a fixture-tier batch only.

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

@midagedev
midagedev merged commit c948fda into main Oct 28, 2026
7 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