Skip to content

fix(qwen3.6): a Mac checks the row decoder's quantization rule, not the CUDA engine's 4-bit/64 rule - #344

Closed
gilby wants to merge 1 commit into
ashhart:mainfrom
gilby:qwen36-mac-check
Closed

gilby wants to merge 1 commit into
ashhart:mainfrom
gilby:qwen36-mac-check

Conversation

@gilby

@gilby gilby commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

qwen3_5_moe.check() refused every checkpoint but MLX 4-bit in groups of 64 on every host, although on a Mac this
family decodes through the dense family's row decoder, which reads per-module affine widths and groups. On a Mac the
check is now that row decoder's own refusal, so oQ-style mixed-width checkpoints load; CUDA keeps its 4-bit/64 rule.

Overlaps #272 (in review), which edits the same check() to admit unquantized bf16 checkpoints on a Mac. Whichever lands second rebases; the merge is a few lines in the darwin branch.

Receipt

  • Environment, with the TensorFold commit, MLX or PyTorch version, machine and GPU, checkpoint and revision: this
    branch on 0.6.4, now rebased on 0.6.5 (609ca41) as 1c7fa68, cleanly; its tests pass there, and 0.6.5 still
    refuses this checkpoint on a Mac (its check() keeps the 4-bit/64 rule), so the fix still applies. M5 Ultra; an oQ4e conversion of ornith-ai/Ornith-1.5-35B-A3B (qwen3_5_moe, 4-bit g32
    base with 360 wider layers) with ornith-ai/Ornith-1.5-35B-A3B-DFlash @ 942d20f (4-bit). Server:
    tensorfold serve <checkpoint> --drafter <drafter> --port 8391 --name ornith. Startup: "windows of up to 128 rows
    reproduce one-row steps here".
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: N=4, code and
    chat, temperature 1.0 and 0: 0 failed, alone 12/12 in every cell, serial ("draft": false) 4/4 sampled and 1/1
    greedy, 0 unequal. Resumed == fresh (M5 Ultra, same checkpoint and drafter): the same
    7,337-token prompt twice on one server (greedy), the second served 7,332 tokens from the prompt cache; token_sha
    0742ef375c69 both times.
  • Decode speed before and after, from tools/bench_openai.py: before is a refusal at load on 0.6.4 ("Qwen3.6 MoE's
    CUDA engine reads MLX 4-bit weights in groups of 64 ...; this checkpoint has MLX 4-bit, groups of 32"). After, two
    runs, median tok/s: fibonacci-raw greedy 246.7 / 248.5, sampled 317.8 / 323.1; gpu-chat greedy 232.6 / 233.0,
    sampled 201.8 / 197.7. Concurrent aggregate (N=4, greedy): code 435.4, chat 385.1.
  • Prompt speed before and after, from tools/prefill_cold.py: after, 3 reps, median: 2k 8,369 tok/s, 8k 8,129,
    16k 7,137, 32k 5,532, 64k 3,662. No before (refused).
  • On v0.6.5: this branch rebased onto v0.6.5 (609ca41) as 1c7fa68. Mac host suite (M5 Ultra): 5005 passed, 1 failed, 596 skipped; the one failure, test_glm5_prompt_kernels::test_fused_index_scores_are_the_three_ops, fails on v0.6.5 too.
  • Tests run, with pass, fail and skip counts: Mac host suite on this branch: 4697 passed, 1 failed, 595 skipped (the one
    failure, test_glm5_prompt_kernels::test_fused_index_scores_are_the_three_ops, fails on 0.6.4 too). New
    tests/test_qwen36_moe_check.py against 0.6.4's source: 1 failed, 3 passed; tests/test_qwen36_family.py against
    0.6.4's source: 1 failed, 8 passed; both pass here.
  • M3 Ultra (no tensor units, so the row decoder's M1–M4 path), v0.6.5 vs this branch, MLX 0.32.3, mlx-lm 0.32.0,
    the same checkpoint and drafter and the same server command: v0.6.5 refuses at load ("Qwen3.6 MoE's CUDA engine reads
    MLX 4-bit weights in groups of 64 ...; this checkpoint has MLX 4-bit, groups of 32"). This branch serves it:
    token_sha drafted == "draft": false == 653724bdd6f0; at --parallel 4, --levels 2,4 --alone --serial 0 failed
    and 0 unequal in all 8 cells; tools/bench_openai.py --tokens 256 --reps 5, medians: fibonacci-raw greedy 187.6,
    sampled 199.9; gpu-chat greedy 156.2, sampled 148.5 tok/s. Concurrent aggregate (N=2 / N=4, greedy): code
    253.2 / 327.6, chat 227.0 / 279.3. The mixed-width layers load without the fp16-scale failure Mixed-width oQ checkpoint (oQ3.5e) fails at startup: MLX JIT kernel-build error in the row decoder (thread bfloat vs device float16_t) #279 describes (this
    checkpoint's scales are bf16).
  • Checked on v0.6.5 (2026-10-04), M5 Ultra: tools/prefill_cold.py (2k / 8k / 16k, 3 reps, median tok/s, alternated with v0.6.5, two runs each) on Vontra/Qwen3.6-35B-A3B-MLX-4bit-MTP (MLX 4-bit in groups of 64), which v0.6.5 serves: v0.6.5 8,689 / 8,384 / 7,303 and 8,649 / 8,330 / 7,314; this branch 8,671 / 8,373 / 7,316 and 8,704 / 8,372 / 7,310.
  • Not run, and why: M1, M2 and M4 (no hardware). CUDA is unchanged by construction (the CUDA branch of check() is the old
    rule) and was not re-run.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Prompt processing is no slower than the last release. (No before on the oQ checkpoint: v0.6.5 refuses it on a Mac. On Vontra/Qwen3.6-35B-A3B-MLX-4bit-MTP, which v0.6.5 serves, M5 Ultra: +0.1 to +0.2% against v0.6.5; see the v0.6.5 check.)
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

…he CUDA engine's 4-bit/64 rule

check() refused every checkpoint but MLX 4-bit in groups of 64 on every host. On a Mac the family decodes
through the dense family's row decoder, which reads per-module affine widths and groups, so oQ-style mixed
checkpoints were refused although they load and decode exactly. On a Mac the check is now the row decoder's
own refusal; CUDA keeps its 4-bit/64 rule.
@ashhart

ashhart commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Thank you, @gilby. Making the Mac's startup check the row decoder's own quantization rule, rather than the CUDA engine's, let oQ mixed-width checkpoints load, and the exactness and speed receipts on both M5 Ultra and M3 Ultra are thorough.

The Python engine is frozen (#286) and new work goes into the Zig engine, so this PR won't merge. Qwen3.6 MoE isn't on the Zig engine yet. The principle carries over. A family's startup check should be exactly the rule its decoder reads, no looser and no stricter, and we will hold the Zig families to it.

@ashhart ashhart closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants