Skip to content

fix: two models regressed to FAIL in the 0.2.1 sweep (hunyuan-moe-a13b-bf16, qwen2.5-vl-3b-4bit) #294

Closed as not planned

Description

@inureyes

Problem / Background

The 2026-06-15 full M5 Max benchmark sweep (mlxcel 0.2.1, MLX pin a6ec7123) surfaced two models that regressed from working to FAIL:bench. Both were passing on the 2026-05-27 sweep and need a coordinated fix pass, so they are tracked here as one issue.

Source data:

  • benchmarks/metal_m5max_2026-06-15.csv (text decode)
  • benchmarks/metal_m5max_vlm_2026-06-15.csv (VLM image decode)
  • docs/benchmark_results/model_tests_m5max.md, Known Issues section, on branch docs/m5max-benchmarks-0.2.1

Regression 1: hunyuan-moe-a13b-bf16

Regression 2: qwen2.5-vl-3b-4bit

  • Was 165.50 tok/s decode on the 2026-05-27 sweep. Now FAIL:bench on 2026-06-15 in both text mode and VLM image mode (confirmed in both CSVs).
  • Previously fixed by issue/PR fix: reset model-owned VLM fallback state #34 (EOS-terminate handling) and had been passing since. Something in the 06-11..06-15 changes broke it again.
  • Additional signal: the non-quantized qwen2.5-vl-3b also shows FAIL:bench in both modes, which points at a shared load/decode path rather than the 4-bit or image branch specifically.

Proposed Solution

Investigate and fix both regressions in one coordinated pass.

For hunyuan-moe-a13b-bf16:

For qwen2.5-vl-3b-4bit:

  • Run mlxcel generate directly (text and --vlm) to capture the real error.
  • Bisect across the same 06-11..06-15 window. Both text and VLM failing suggests a shared load/decode path, not the image branch.
  • Re-validate that the fix: reset model-owned VLM fallback state #34 EOS-terminate behavior still holds after the fix.

Reproduction

M5 Max (or any Apple Silicon) with the checkpoints under models/:

./scripts/bench_decode.sh models/hunyuan-moe-a13b-bf16
./scripts/bench_decode.sh models/qwen2.5-vl-3b-4bit
./scripts/bench_decode.sh models/qwen2.5-vl-3b-4bit --vlm

Or directly, to see the real error the harness hides behind FAIL:bench:

./target/release/mlxcel generate -m models/hunyuan-moe-a13b-bf16 -p "Hello" -n 50 --profile
./target/release/mlxcel generate -m models/qwen2.5-vl-3b-4bit -p "Hello" -n 50 --profile

To test the fused-MoE hypothesis for hunyuan:

MLXCEL_FUSED_MOE=0 ./target/release/mlxcel generate -m models/hunyuan-moe-a13b-bf16 -p "Hello" -n 50 --profile

Acceptance Criteria

Technical Considerations

Activity

  1. added
    status:ready
    type:bug
    priority:high
    area:models
    area:inference
    platform:macos
    on Jun 15, 2026
  2. inureyes commented on Jun 15, 2026

    @inureyes
    MemberAuthor

    M1 Ultra investigation (cannot reproduce here; both look M5 Max-specific)

    Tried to reproduce both regressions on M1 Ultra (128GB, mlxcel main post #289/#291). Neither reproduces on this hardware, so both appear to be M5 Max-specific. Details and a refined direction for the M5 follow-up:

    Regression 2: qwen2.5-vl-3b-4bit -> healthy on M1 Ultra

    Downloaded mlx-community/Qwen2.5-VL-3B-Instruct-4bit and ran the same-process warmup+measure harness:

    • Text: mlxcel-bench-decode -m models/qwen2.5-vl-3b-4bit -p "Hello, how are you today?" -n 100 --warmup-tokens 20 -> 103.20 tok/s decode, no abort.
    • VLM (image): coherent output, 45.73 tok/s decode.

    So the FAIL is not in the shared/model code; it is in the M5 Max path. The vlm_concurrency.rs guard (#38) already notes the original abort was "during warmup on M5 Max", which points at an M5 neural-accelerator code path (the kind gated on hw.has_neural_accelerator && hw.macos_supports_na), not the generic transformer path that M1 Ultra exercises.

    M5 follow-up:

    1. Re-run on current main first (the 06-15 M5 sweep predates perf: bf16->f16 quant-scale promotion (#260) regresses bf16-scale quantized model decode ~33-41% on M1 Ultra #289/fix(models): infer per-tensor bits for quantized embeddings (mixed-precision exports like diffusiongemma fail to load) #291; confirm it still fails after those merges).
    2. Capture the actual stderr of the FAIL:bench abort on M5 (the CSV only records FAIL:bench). That message will pin it.
    3. Run the ignored guard directly: cargo test --release --test vlm_concurrency -- --ignored qwen2_5_vl_single_row_bench_prefill_succeeds_with_m5_warmup.
    4. Bisect the M5-specific attention/SDPA warmup path between v0.0.29 (when fix: reset model-owned VLM fallback state #34/test(vision): add qwen2.5-vl-3b-4bit warmup regression guard #38 fixed it) and the 0.2.1 sweep binary.

    Regression 1: hunyuan-moe-a13b-bf16 -> a memory limit, not the fused-MoE kernel

    Hunyuan-A13B is 80B total (64 experts x 32 layers), so the bf16 export is ~160GB and cannot fit 128GB unified memory on either M5 Max or M1 Ultra. The ~64 tok/s at 0.1.0 reading was almost certainly mmap/paging-assisted and at the edge of the limit; a small memory-behavior change in 0.2.x most likely tips it into OOM -> FAIL:bench.

    The issue's leading hypothesis (fused decode-MoE default-on does not handle bf16 experts) is ruled out by code: for non-quantized experts SwitchLinear is the Regular variant, quantized_parts() returns None, and forward_fused_kernel returns None -> it falls back to the existing gather_mm path. So MLXCEL_FUSED_MOE never touches the bf16 MoE path. MLXCEL_FUSED_MOE=0 is expected to make no difference for this model.

    The 4-bit variant is fine and is the practical path:

    • mlx-community/Hunyuan-A13B-Instruct-4bit (~42GB) runs on M1 Ultra at 44.62 tok/s and passes on M5 Max (~64 tok/s in this same sweep: hunyuan-large-4bit 64.70, hunyuan-4bit 64.60, hunyuan-13b 64.75 are all this same 4-bit checkpoint).

    Recommendation for regression 1: resolve as "bf16 Hunyuan-A13B (~160GB) exceeds 128GB; use the 4-bit variant" and, if desired, add a graceful pre-load memory check so it reports an OOM instead of aborting mid-load (validate on M5 Max). This is not a functional gap, since the 4-bit path works.

    Summary

    • qwen2.5-vl-3b-4bit: works on M1 Ultra; real bug is on the M5 NA warmup path -> needs M5 repro + the abort stderr.
    • hunyuan-moe-a13b-bf16: 160GB does not fit 128GB; not fused-MoE; use the 4-bit variant. Optional: graceful OOM.
  3. added a commit that references this issue on Jun 15, 2026
  4. inureyes commented on Jun 15, 2026

    @inureyes
    MemberAuthor

    Closing as not a code regression. Re-tested both models on mlxcel 0.2.1 (HEAD 891b9ef, rebuilt after the layers.rs pull); both failures were environmental:

    • qwen2.5-vl-3b-4bit: the sweep hit a corrupt checkpoint. After re-downloading the weights it passes again — 164.49 tok/s text, 155.60 tok/s VLM, with coherent text and a correct image description. No code change needed.
    • hunyuan-moe-a13b-bf16: the bf16 A13B exceeds the 128 GB memory budget and OOMs at load. Dropped in favor of the 4-bit hunyuan-a13b-instruct-4bit, which runs fine at 64.92 tok/s and is now the canonical Hunyuan MoE reference (the redundant Hunyuan checkpoints were deduped).

    Docs corrected in #296: qwen2.5-vl restored to pass in both tables, the Hunyuan MoE rows consolidated onto the 4-bit checkpoint, and the two High Known-Issues entries cleared.

    One minor harness gap noted (not blocking, captured as a Low note in the M5 Max doc): the oversized bf16 passed the size estimate and then OOM'd at load, so the bench logged FAIL:bench instead of a clean SKIP:oom. Worth a small separate issue if we want the size estimator to account for bf16 expansion.

  5. added this to the 0.3 milestone on Jun 21, 2026
  6. self-assigned this
    on Jun 21, 2026
  7. added
    status:wontfix
    and removed
    status:ready
    on Sep 7, 2026
  8. added a commit that references this issue on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:inferencearea:modelsplatform:macospriority:highstatus:wontfixtype:bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions