Repository navigation
metal: LFM3-1.7B from its MLX folder (short conv, gated windowed attention, sandwich joins) - #943
Conversation
…hape::select_gqa_in), and takes LFM3's per-head gate, rope factors and short conv Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
…d per-head gated attention, the sandwich joins, two rope tables, a tied head, and checkpoints that hold the conv rings Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
…estores the conv rings, and the N=16 A4 GEMM and segment cases Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
…to each mark and takes its point between passes, so the server's marks run on LFM3 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
…tions 0 to 3 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
There was a problem hiding this comment.
Verdict: MUST_FIX: the short conv buffers have three accessors in this diff, two of them the same code; the behavior paths I built are blocked.
Must fix
1. One owner for "layer l's ConvBufs": the conv_of! macro and conv_of_rows are copies
ops.rs:288 is a 21-line macro that matches MixerBufs::ShortConv and refuses the other two variants by name. rows.rs:64 conv_of_rows does the same match with a different message. Both are new in this diff, and the macro has two callers (ops.rs:660, ops.rs:695), the function two (rows.rs:472, rows.rs:512). The macro only needs to be a macro because mod rows; sits above it. A function removes the reason.
Cost: the next mixer variant or message change must be made in both places. The fix removes the macro (net fewer elements).
Fix: in ops.rs, delete macro_rules! conv_of, add this function, and add ConvBufs to the super::arena import. Use conv_bufs(layers, l)? at ops.rs:660 and conv_bufs(layers, l.layer)? at ops.rs:695. Delete conv_of_rows from rows.rs, import conv_bufs from super, and use it at rows.rs:472 and rows.rs:512. Drop the imports that become unused (ConvBufs in rows.rs).
/// Layer `l`'s short conv buffers, or the named refusal for a layer of another
/// mixer.
fn conv_bufs(layers: &mut [LayerBufs], l: usize) -> Result<&mut ConvBufs, SessionError> {
match &mut layers[l].mixer {
MixerBufs::ShortConv(c) => Ok(c),
MixerBufs::Delta(_) | MixerBufs::Attention(_) => Err(refuse(format!(
"layer {l}: a short conv op on a layer of another mixer"
))),
}
}Non-blocking
⚠ PIN date is in the future: row.rs:115 says PIN(2026-10-29). The review ran on 2026-10-28, and the Qwen pin beside it is 2026-10-28. Use the date the band was measured.
⚠ The lfm3 row has Mutants::None (row.rs:227). --mutants-all is not run for it in just lab-metal-e2e. The body says the cut is red without the conv rings, but only a planted mutant proves it. Name the one mutant run, or add the PR body line that shows it.
⚠ The LFM3_ATTN row is only exercised up to position 3 in the e2e gate, and docs/mac.md says so. The window cut (256 keys) and the rope factors on full layers are not reached by m_logits. A gate row past 256 keys is the next piece of work, not this PR.
Checked
- Duplicates: about 40 new functions, types and constants checked. One hit (finding 1). The dryer pairs are read: ops.rs:329-348 and the
attn_of/delta_of/conv_ofaccessors in arena.rs share a shape, not knowledge (different variants and buffers). The twohalf_outfunctions take different buffer and mode types. Theselect_gqa_infallback replacedgqa_row_vwith the already filteredwidth;gqa_row_vkeeps its other callers. - Complexity:
rows_p120 → 39 is a branch added to an existing function (the gate split); each branch is a named refusal, and the split to a helper is its own piece of work.select_gqa_in,cut_marked_pass,read_specare new and complex on their own; I read them for correctness only. - Silent failure: 14 sites followed (
rope_of,post_gain,no_join,no_conv_y,no_gate_rows,take_point,cut,has_recurrent_store,copies_in_pass, theKey::ofrefusals,check_strided,argmax_of,parse_pin, the marks branch intarget.rs). Each bad input gets a named refusal. A file with conv rings and no checkpoints is refused, not skipped (session.rsno_checkpoints). - Hot path: the decode step adds no allocation and no host copy; every
format!is on an error path, andcheck_stridednow builds its message on the error path only. The new launches are the sandwich joins (one group per half on a sandwich layer). No kernel file changed, and the body showsmetal_scan --compareat added=0 removed=0 changed=0. - Tests: mutant checked in words for
store_lens_of(dropHeld::Convturns the first test red),extents(drop the offset turns the P1 test red),strided_len(rows * strideturns its test red),select_gqa_in(readGQAinstead oftableturns its test red),check_strided(delete theu32refusal turns its test red). - Gates:
QWEN_LOGIT_ABS0.01 moved unchanged with its PIN;LFM3_LOGIT_ABS0.06 is new, with its derivation. No gate removed. - Escape catalog: no match (one shell file changed: the
justfilerecipe adds a--row lfm3line).
Notes
- No CUDA evidence applies: this PR changes only the Metal backend and the models shape table. The body gives an Apple M1 Pro run with the gate commands, which I could not re-run.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
…code and the prompt rows alike Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
…9 of a 600-id walk), its band, and the window and ring mutants Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd
There was a problem hiding this comment.
Verdict: CLEAN: the earlier must-fix is fixed, and the new commits (deep pin, LFM3 mutants, pin tooling) leave no failure path I could not block.
Since the last review:
- Must-fix 1 (
conv_of!andconv_of_rows): fixed. Oneconv_bufsat ops.rs:290, four callers, the macro and the rows copy are gone, and the imports match. - ⚠ PIN date: fixed. Both PINs in
row.rssay 2026-10-29, the run date. - ⚠
lfm3hadMutants::None: fixed.Mutants::Lfm3holds three mutants, and the justfile runs--row lfm3 --mutants-all. - ⚠ No gate past the 256-key window: fixed.
m_logits_deepreads seven steps of a 600-id walk.
Checked
- Duplicates: 9 new items checked (
hold,DEEP_DIR,pin_of(sub),LFM3table,Mutants::Lfm3,deep_logit_abs, the walk and positions helpers inmlx-logits.py). None duplicated.m_logitsis now a thin call intohold, so the two clauses share one loop. The dryer pairs are old code or short same-shape copies from the first review. - Complexity: no function the new commits touch is in the crapper list.
parse_pin21 → 31 grew two branches in the first review, and thepositionsbranch added here is a named error for each bad input. - Silent failure: 5 sites followed.
parse_pinrefuses positions that are not increasing, reach past the steps, or disagree with the byte count. The argmax line is checked against the held rows, not the steps.holdskips a step only when the pin names no row for it.dumprefuses a non-finite logit and an id outside the vocabulary.--idswith--ids-walkand an empty position list are named errors. - Tests (mutation, in words):
swa_window_shortandswa_window_longprotectattention.metal's window start. A 255 or 257 window moves the reference logits by 0.11 to 0.15, above the 0.02 band at steps 256 to 599.shortconv_ring_no_wrapprotectsshortconv.metal:140. A wrong slot from position 15 turnsm_logits_deepred. All three edit strings exist once in the kernel sources. The rope-factors host edit matchesarena.rs:394.LFM3_DEEP_LOGIT_ABSequals its cap by assertion, and the measured worst is 6.0e-3. - Gates:
LFM3_DEEP_LOGIT_ABS0.02 is new, with a dated PIN and derivation. No gate moved or removed. - Hot path: none touched in these commits. The change is a function move, tests and tools.
- Escape catalog: no match. The justfile adds one recipe line.
Notes
- No CUDA evidence applies: the PR changes only Metal and the models shape table. The body gives an Apple M1 Pro run, which I could not re-run.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
Metal runs LFM3-1.7B from its MLX folder (
LiquidAI/LFM3-1.7B-MLX-4bit).The qwen3moe session takes the plan's short conv layers, windowed attention with a per-head gate, the sandwich joins, two rope tables and a tied head. An instance key selects its attention from Metal's own rows (
shape::select_gqa_in). Checkpoints and a cut hold the conv rings. A marked prompt call on a file with a conv layer splits its passes at the marks.Evidence (Apple M1 Pro, this branch on main fdc0cca):
gate_metal_qwen35moe_e2e --row lfm3: PASS. It checks mlx-vlm's BOS pin (ids 124894,597,4104,10299, argmax [11, 2719, 368, 35886]) and the logits withinLFM3_LOGIT_ABS0.06 (PIN with derivation; measured 3.07e-3). It also checks a cut that restores the conv rings (red without them).gate_metal_qwen35moe_kernels: PASS, and--mutants-allPASS on all 6 instances.metal_scan --compareagainst main gives added=0 removed=0 changed=0. Encode traces and ids at depth 0 and 600 are identical.m_logits_deepholds steps 255, 256, 257, 300, 302, 357 and 599 of a 600-id walk (past the 256-key window) to mlx-vlm in f32.--row lfm3 --mutants-all: PASS (window 255, window 257, ring without wrap, each red).conv_bufsowner for a layer's short conv buffers (the macro and the rows copy are gone).just remote-static origin/mainrc 0 (rerun after the review fix).Speed on the M1 Pro, 3 rotated rounds against mlx-vlm 0.7.11 / mlx 0.32.4:
AI use: written and checked with Claude Code.
🤖 Generated with Claude Code
https://claude.ai/code/session_01X1hsQfNpqr2jqmpYe8SFXd