Repository navigation
fix(perf): improve Gemma3n bf16 prefill path - #28
Merged
Merged
Conversation
Materialize full-precision bf16 casts and preserve the Gemma3n language MLP bf16 path to improve gemma3n-e4b-bf16 decode from 11.16 to 38.81 tok/s while keeping coherent output.
inureyes
added a commit
that referenced
this pull request
May 18, 2026
This release focuses on Apple Silicon decode performance for VLM and linear-attention model families, plus a CLI fix for `mlxcel list`. Performance: - Gemma3n bf16 prefill path: gemma3n-e4b-bf16 decode 11.16 to 38.81 tok/s on M5 Max (#28). - Qwen3-VL text-only decode: QKV fusion + `forward_text_only` fast path. Qwen3-VL-30B-A3B-Instruct-4bit decode 56.00 to 146.29 tok/s (2.61x, 99% of mlx-lm parity); Qwen3-VL-32B-Instruct-4bit decode 18.79 to 27.33 tok/s (1.45x, 94% parity); image-in-prompt and DeepStack paths unchanged (#29). - GatedDeltaNet fast RMSNorm in Qwen3.5 / Qwen3-Next / KimiLinear: `mlx::fast::rms_norm` replaces the expanded square / mean / sqrt / divide graph for Q/K and gated output. qwen3.5-0.8b-4bit decode 425.16 to 535.43 tok/s on M5 Max (+25.9%, 96% parity); Qwen3.5 speculative-decoding verify pass updated alongside prefill / decode to preserve draft / verify dtype agreement (#30). Fixed: - Rewrite `mlxcel list` output to drive from the `ModelType` registry: fixes stale count, missing VLM family, missing ~30 model types, and removes a broken docs link (#27). Docs: - Refresh README performance snapshot and `docs/benchmarks.md` to match the latest M5 Max sweep.
sjswerdloff
added a commit
to sjswerdloff/mlxcel
that referenced
this pull request
Jul 10, 2026
…truction] msa_fetch/fp16_gathered (Clement seat closed: approve, no must-fixes; Xander's seat open at his wake) Env instruments demote to default seeds; store is single source of truth at every dispatch site. Runtime msa_core makes the G core axis boot-free for the morning A/B leg (task lablup#28); construction keys are boot-frozen with warn-on-divergence. Header echo: path=..; core=..; v=N. Both gathered cores carry first-dispatch witnesses. Latch-order property (review note a): init_and_watch's boot-time file load precedes first dispatch on the server path; TOML-less processes latch env-seeded defaults at first touch by design. Verification (sharded per lablup#29 convention, isolated target): decode_config 26, server::routes 77, m3 50, core cache 480, bins build. Full-suite SIGTRAP reproduced on BASE without this change — pre-existing, lablup#29 updated with the datum.
sjswerdloff
added a commit
to sjswerdloff/mlxcel
that referenced
this pull request
Jul 11, 2026
…, 64GiB server serving; far-side pickup = golden harness with verified preconditions Co-Authored-By: clement-7074f29f <[email protected]>
sjswerdloff
added a commit
to sjswerdloff/mlxcel
that referenced
this pull request
Jul 11, 2026
The gate's record (2026-07-11, Violet's verdict 20:06): completions BIT-IDENTICAL to blocked across kernel schedules at 295K (1,500 greedy tokens, diff empty), sdpa +3.4–8.1% tok/s. Safe everywhere by construction — the masked SDPA core consumes fp16 compact windows regardless of source (fp16-gathered or kvarn-dequanted). Env instrument keeps switch semantics against the NEW default: MLXCEL_MSA_CORE=blocked selects the non-default; anything else (including parse garbage) means sdpa. The two default-pinning tests flipped WITH the default, deliberately, citing the gate — exactly the red a default flip owes. Evidence: decode_config 26/26, msa 29/29, C contracts 2/2 (their gathered reference now runs the sdpa core live — still 1e-3-matched, consistent with the gate's bit-identical finding), root lib 1,876 passed / 0 failed before the known lablup#29 teardown SIGTRAP. Co-Authored-By: clement-7074f29f <[email protected]>
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
Materialize full-precision bf16 casts and preserve the Gemma3n language MLP bf16 path to improve gemma3n-e4b-bf16 decode from 11.16 to 38.81 tok/s while keeping coherent output.
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
This release focuses on Apple Silicon decode performance for VLM and linear-attention model families, plus a CLI fix for `mlxcel list`. Performance: - Gemma3n bf16 prefill path: gemma3n-e4b-bf16 decode 11.16 to 38.81 tok/s on M5 Max (lablup#28). - Qwen3-VL text-only decode: QKV fusion + `forward_text_only` fast path. Qwen3-VL-30B-A3B-Instruct-4bit decode 56.00 to 146.29 tok/s (2.61x, 99% of mlx-lm parity); Qwen3-VL-32B-Instruct-4bit decode 18.79 to 27.33 tok/s (1.45x, 94% parity); image-in-prompt and DeepStack paths unchanged (lablup#29). - GatedDeltaNet fast RMSNorm in Qwen3.5 / Qwen3-Next / KimiLinear: `mlx::fast::rms_norm` replaces the expanded square / mean / sqrt / divide graph for Q/K and gated output. qwen3.5-0.8b-4bit decode 425.16 to 535.43 tok/s on M5 Max (+25.9%, 96% parity); Qwen3.5 speculative-decoding verify pass updated alongside prefill / decode to preserve draft / verify dtype agreement (lablup#30). Fixed: - Rewrite `mlxcel list` output to drive from the `ModelType` registry: fixes stale count, missing VLM family, missing ~30 model types, and removes a broken docs link (lablup#27). Docs: - Refresh README performance snapshot and `docs/benchmarks.md` to match the latest M5 Max sweep.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gemma-3n-E4B-it (bf16): decode 11.16 → 38.81 tok/s (~3.0x), output stays coherent.Changes
src/models/gemma3n.rs— preserve bf16 along the language MLP, restructure dtype handling in prefill.src/models/sanitize.rs— materialize full-precision bf16 casts where the previous shortcut left tensors in a slow mixed-dtype state.src/loading/vlm.rs,src/models/mod.rs— wiring for the above.Test plan
cargo check --features metal,accelerategemma-3n-E4B-it (bf16)decode tok/s on M5 Max matches the reported ~38.8 tok/s.