Repository navigation
Fixes and stricter checks, prompted by an independent review of the technical report draft.
- Bitwise comparison:
mx.array_equaltreats +0 and −0 as equal, so tests based on it could not establish bit-identical results. The newmlx_exact.testing.bits_equalcompares the stored bit patterns, and every test and experiment now uses it.- The full suite passes under it.
- The seven real checkpoints pass every check bit for bit: Llama-3.2-1B, Qwen2.5-1.5B, SmolLM3-3B, Phi-4-mini, Gemma-3-1B, Gemma-3-4B, and Gemma-2-2B for single sequences.
- Gradients:
- mxfp4 layers had no backward pass since 0.9.0, and Gemma 2's attention had none in 0.13.0 (the custom kernels had no VJP).
- Full-prefill attention with sinks had none either, because stock MLX's backward pass rejects sinks.
- All three now have one. Backward passes are correct gradients, not bit-exact ones.
mx.matmul(a, b, stream=...)raised TypeError while exact mode was on (0.13.0). The stream is now honoured.- Docs: MLX's dispatch boundaries are corrected.
- split-K partitions go up to K/64;
- head dim 192 is unfused at every query count;
- head dim 256 switches to a fused kernel from 1,024 queries only with causal or array masks;
- head dim 512's fused long-prefill kernel (Gemma 4's global layers) is listed as not validated.
- The environment guard is described precisely: it checks the MLX version and GPU generation, not mlx-lm.
- New tests:
tests/test_gradients.py. 275 tests in all.
Install: pip install "mlx-exact[lm] @ git+https://github.com/audenvenn/mlx-exact@v0.13.1". Validated on Apple M6 with MLX 0.32.4 and mlx-lm 0.32.2.
Developed with AI assistance (Anthropic's Claude).