Repository navigation
mlx-exact 0.8.1
Faster fixed-order attention for head dims 192/256 with one KV head (e.g. Gemma 3 1B / 270M):
- Prefill attention is 2.4–3× faster: 0.95 vs 2.32 ms at 512 tokens and 11.8 vs 35.4 ms at 2,048 tokens, against stock MLX's 0.32 / 0.97 ms (Apple M6, causal, 4 query heads, 1 KV head, head dim 256).
- Decode attention is the same or faster.
- How: every output is still the same sequential fp32 chain. Each thread now computes a 4 × 4 block of outputs from tiles staged in threadgroup memory, and one SIMD group handles each softmax row; its sum stays sequential.
- Results are bit-identical to 0.8.0.
tests/test_fixed_order.pykeeps the previous kernels as the reference; 232 tests.
Install: pip install "mlx-exact[lm] @ git+https://github.com/audenvenn/mlx-exact@v0.8.1". Validated on Apple M6 with MLX 0.32.4 and mlx-lm 0.32.2.
Developed with AI assistance (Anthropic's Claude).