Repository navigation
Conversation
…ow decoder The family's check refused every checkpoint without MLX affine metadata, though its Mac lane loads through mlx_lm, which reads bf16 weights as stored. A Mac now takes that case and keeps the 4-bit/groups-of-64 rule for anything quantized and for every CUDA host; the row decoder gains a plain backend whose projections are one-row mx.matmul calls, so a window's row keeps its one-row bits, and a model with any quantized linear still needs the simd_qmm path.
… bits on the plain backend A tiny unquantized Qwen3.6-MoE-shaped TextModel (16 experts, 8 a token, a shared expert) checks window rows and shared streams against one-row steps, plain projections against their modules, that a partly quantized model is refused rather than misread, that check admits unquantized weights on a Mac only, and that load routes bf16 through the row decoder.
…16 checkpoint The recipe page gains a Mac execution section (Ornith's 67 GB bf16 layout, the row decoder's one-row bits, the MTP tensors a Mac does not read), the recipe table a bf16 column, and the runbook a pointer beside the 27B's Mac notes.
|
Thank you, @bunnyfu. The receipts here are thorough, and you measured why the plain backend has to loop one row at a time: MLX's batched bf16 matmul is not row-exact on these shapes. Working out that prompt 0 split on an exact top-2 tie in the reference itself was careful too. The Python engine is frozen (#286), so this won't merge there. Qwen3.6 MoE isn't on the Zig engine yet, so unquantized checkpoints for it wait for that family. The Zig engine already has bf16 projection kernels that fix each sum's order, so a row gets its one-row bits whether it runs alone or inside a window on the matrix units, and the family shouldn't need a per-row loop. Your tests, windows and shared streams equal to one-row steps, are the checks it gets, with your credit. |
What
This adds a bf16 recipe for
qwen3_5_moeon a Mac: the family can now serve a wholly unquantized checkpoint of this architecture. Before this,checkrefused every checkpoint that lacked MLX affine 4-bit metadata — even thoughloadgoes through mlx_lm, which happily reads bf16 weights as stored. So a 35B checkpoint likejunafinity/Ornith-1.5-35B-A3B-uncensored(67 GB bf16, 17 shards, fusedexperts.gate_up_projlayout) was loadable and unservable. Now it serves.Two changes make it work. First,
checkadmits an unquantized checkpoint on darwin only; quantized checkpoints and every CUDA host keep the existing 4-bit/groups-of-64 rule untouched. Second, the row decoder gains a plain bf16 backend: every projection becomes its own one-rowmx.matmul. That per-row loop is deliberate — a batched bf16 matmul is not row-exact (we measured row-bit mismatches at several projection shapes on M3 Max), and a drafted or shared window's row must keep exactly its one-row bits. A model with any quantized linear still requires the simd_qmm path, so no existing checkpoint changes reading.One subtlety worth flagging: mlx_lm's sanitize drops the vision tower and the MTP tensors a bf16 checkpoint carries. The MTP weights are simply not read by the Mac lane today (it drafts with the DFlash v1 head); whether a Mac-lane MTP drafter makes sense is an open question — #274.
Receipts
New tests —
tests/test_qwen36_moe_bf16.py, 7 tests, all green: window rows and shared streams equal one-row steps bit for bit on a tiny unquantized Qwen3.6-MoE-shaped model; plain projections equal their modules' bits; a partly quantized model is refused;checkadmits unquantized on a Mac only;loadroutes bf16 through the row decoder.Focused gate over every touched consumer — 405 passed across test_qwen36_moe_bf16, test_qwen36_moe_rows, test_qwen36_family, test_qwen3_5_load, test_row_forward, test_unsupported_checkpoints, test_hub_and_checks, test_simd_qmm, test_simd_qmm_bits, test_affine_rows, test_affine_rows_metal, and the two test_lane_server admission tests.
Full Mac suite — 4,758 collected (
--ignore=tests/cuda --ignore=tests/test_glm_exl3_bits.py, the latter CUDA-only since it imports triton): 4,371 passed / 376 skipped / 16 failed. All 16 fail identically on a pristine 0.6.2 worktree of main (14), or pass in isolation (2, order-dependent) — pre-existing baseline, none introduced by this branch. Upstream main carries no CI workflow at this SHA and recent PRs show zero checks, so these local runs are the receipt surface.Real-checkpoint parity, staged (mlx_lm reference saved first, recipe lane second, never co-resident — they don't fit in RAM together). Greedy continuations: prompts 1 and 2 agree with the reference on all 8 decode steps; prompt 0 diverges at an exact top-2 tie in the reference itself — p(id 11) = p(id 13) = 0.43236102 in fp64, the recipe's step-0 argmax is the other half of the tie at ref-rank 0 — after which the continuation legitimately differs. Teacher-forced NLL delta over the reference's greedy 8-step paths: +0.0123 and +0.0385 nats. Max logit difference at prompt end: 0.44–0.84 across the 248,320 vocab logits, which is bf16 accumulation-order noise between mlx_lm's batched forward and the lane's one-row arithmetic; the engine's own contract — row-exactness against its serial decode — was verified to 128 rows on the real weights at load time.
Serve smoke on a spare port (M3 Max 128 GB,
--context 4096 --no-drafts, 65.0 GiB resident, 49 s load): coherent chat, deterministic greedy repeats, three concurrent streams each byte-identical to the solo reply, ~29.7 tok/s serial decode.Notes for review
docs/recipes/qwen3.6-moe.mdgains a Mac execution section (Ornith layout, one-row matmul bits, MTP tensors not read on Mac, 128 GB / small--contextguidance); the recipes table and RUNBOOK get pointers.