Up to 211% faster matrix multiplication on modern Apple Silicon The experimental library mlx-tachyon reports up to 211% faster matrix multiplication on Apple Silicon by combining sub-cubic, finite-ring modular CRT and Hadamard-INT8 kernels targeting Apple M5-series Neural Accelerators via MLX and Metal 4. The library's fast_matmul_fp64 runs 12.2×–13.7× faster than Apple M5 Max CPU Accelerate FP64 at rel_L2 = 5.91e-15, while its no_quant mode delivers up to 69.0 effective TFLOP/s on 15360³ bfloat16/float16, a +30% to +49% wall-clock speedup over mx.matmul. A drop-in tachyonize(model) accelerates Qwen3-style training steps by +10.0% (2L 1.3B) to +20.5% (1L 8B) with identical 3-seed loss (mean_gap = -0.0010); on M1–M4 or CPU the library detects the absence of Metal 4 NAX at runtime and falls back to mx.matmul with a warning. Sub-cubic, finite-ring modular CRT, and Hadamard-INT8-NAX matrix multiplication kernels for Apple Silicon MLX / Metal 4 . mlx-tachyon is an experimental-to-production research library for Apple MLX https://github.com/ml-explore/mlx targeting Apple M5-series Neural Accelerators mpp::tensor ops::matmul2d . On M1–M4 or CPU environments, it detects the lack of Metal 4 NAX at runtime and falls back cleanly to mx.matmul with a warning. Apple's built-in mx.matmul already reaches ~93% of M5 Max's nominal 16-bit mlx-tachyon explores algorithmic ways to improve speed or precision on top of Apple Silicon's hardware: 1. Floating-point without INT8 quantization mode="no quant" : - EqFP16-NAX float32 : Exact IEEE-754 power-of-2 row equilibration across$10^{\pm 38}$ dynamic range + FP16 NAX with FP32 accumulation rel L2 = 2.93e-4 vs FP64 , +29% to +41% faster than MLX's default relaxed float32 on M5 . - Auto-compiled pure-dyadic Smirnov Performs$\langle 3,3,6; 40 \rangle$ :$40/54 = 0.741\times$ $1.350\times$ fewer , delivering up to 69.0 effective TFLOP/s 51.1 actual hardware TFLOP/s on$15360^3$ bfloat16 / float16 +30% to +49% wall-clock speedup over mx.matmul . 2. 3. Finite-ring modular sub-cubic arithmetic mode="strict fp32" & fast matmul fp64 : - Executes pure-dyadic Smirnov $\langle 3,3,6; 40 \rangle$ inside pairwise-coprime odd residue rings$\mathbb{Z}/m s\mathbb{Z}$ 0.000e+0 bit-exact homomorphism vs direct CRT — eliminating floating-point sub-cubic instability , reconstructed via 72-bit triple-float CRT on 8-bit integer NAX cores. - Delivers strict IEEE-754 float32 rel L2 = 3.82e-7 , +26% to +70% faster than M5 Max's strict-FP32 NAX path and 15-digit IEEE-754 float64 rel L2 = 5.91e-15 , max|err| = 9.38e-16 at 5.9–6.8 effective TFLOP/s 12.2×–13.7× faster than Apple M5 Max CPU Accelerate FP64 on$6144^3$ –$9216^3$ . 4. Executes pure-dyadic Smirnov 5. Lossy INT8 LLM training kernels mode="fast train" & tachyonize model : - Maps bfloat16 / float16 / float32 onto M5 Max's 122.4 TOPS INT8 NAX using bilinear diagonal channel balancing $\Lambda \Lambda^{-1} = I$ , vectorized atomic-max column transforms, and optional reproducible unbiased stochastic rounding ~1.2% rel L2 noise, zero bias . - Drop-in tachyonize model accelerates real end-to-end Qwen3-style training steps including RMSNorm, QK-Norm, RoPE, causal SDPA, cross-entropy, backward, and AdamW by +10.0% 2L 1.3B to +20.5% 1L 8B with identical 3-seed loss mean gap = -0.0010 and gradient norms. 6. Maps 7. High-precision 2-slice Ozaki mode="high prec" : - 2-slice residual RHT-INT8 rel L2 = 8.23e-5 vs FP64 , ~9.3× closer to FP64 than MLX's default relaxed float32 on M5. 8. 2-slice residual RHT-INT8 Experimental modes: mode="experimental ultra" Direct-INT8 Smirnov-40, ~3.1% rel L2 and opt-in allow experimental=True Kronecker ~1.7e-3 in fp16 at ~6.2% in INT8 at $\langle 6,6,12; 280 \rangle$ $\ge 18432^3$ ,$\ge 24576^3$ are explicitly marked experimental due to narrow activation thresholds or higher approximation noise. | Workload | Recommended API | Expected Error vs FP64 | Expected Wall-Clock Gain | |---|---|---|---| | Dense float64 scientific computing | fast matmul fp64 A, B | 5.9e-15 15-digit IEEE | 12×–13.7× vs CPU Accelerate FP64 | | Strict IEEE-754 float32 | fast matmul ..., mode="strict fp32" | 3.8e-7 | +26% to +70% vs strict-FP32 NAX | | Relaxed float32 dense GEMMs | fast matmul ..., mode="no quant" | 2.9e-4 vs MLX M5 7.7e-4 | +29% to +72% vs MLX fp32 | | Large fp16 / bf16 GEMMs | fast matmul ..., mode="no quant" | 8.4e-4 fp16 / 1.8e-3 bf16 | +18% to +49% vs MLX fp16 / bf16 | | LLM training = 1B–8B , bf16 | tachyonize model, stochastic=True | ~1.2e-2 unbiased, zero drift | +10% to +20.5% end-to-end step +41% linear ops on 8B | | Single-token decode M = 1 or small matrices < 1024 | Native mx.matmul | — | No gain auto-falls back cleanly | Hardware & MLX Pin: Tested on Apple M5 Max applegpu g17s , 128 GB unified memory, macOS 27.2.1 with MLX 0.32.4 pyproject.toml pins mlx =0.32.0,<0.34.0 . On M1–M4 Macs, has metal4 nax returns False and fast matmul falls back cleanly to mx.matmul . git clone https://github.com/davedx/mlx-tachyon.git cd mlx-tachyon pip install -e . You don't need to memorize algorithm names — pass max rel err=... and return info=True to see the exact path taken, padding applied, expected error range, and physical-ops ratio: python import mlx.core as mx from mlx tachyon import fast matmul, fast matmul fp64 A = mx.random.normal 4096, 4096 .astype mx.float32 B = mx.random.normal 4096, 4096 .astype mx.float32 Let mlx-tachyon choose the fastest path meeting your error contract C, info = fast matmul A, B, layout="NT", max rel err=1e-3, return info=True print info DispatchInfo path='eq fp16 nax', ..., expected rel err= 0.00025, 0.00035 , actual hw ops ratio=1.0, reason='ok' Or pick a mode explicitly supports 2D and batched 3D+ inputs, deterministic seed for SR A bf = A.astype mx.bfloat16 B bf = B.astype mx.bfloat16 C train = fast matmul A bf, B bf, layout="NT", mode="fast train", stochastic=True, seed=42 15-digit IEEE-754 double precision on GPU accepts NumPy float64 arrays import numpy as np C64, info64 = fast matmul fp64 np.random.randn 2048, 2048 , np.random.randn 2048, 2048 , return info=True python import mlx.nn as nn from mlx tachyon import tachyonize Replaces eligible nn.Linear / CastLinear layers with FastLinear preserves fp32 master weights & skips lm head/embed report = tachyonize model, min features=1024, skip names= "lm head", "embed" , stochastic=True, seed=42 print "Swapped layers:", len report "replaced" All single-GEMM benchmarks below were measured on an idle Apple M5 Max applegpu g17s , macOS 27.2.1, MLX 0.32.4 . We report both Effective TFLOP/s Actual Physical Hardware Ops/s actual hw ops ratio × Effective alongside measured relative L2 error vs FP64 . Before comparing float32 paths, we empirically probed what MLX 0.32.4 mx.matmul float32 actually computes on applegpu g17s using x = 1 + 0.75 · 2⁻¹⁰ = 1.0007324219 : - mx.matmul float32 returned 1.0000000000 — confirming MLX defaults to Metal 4's relaxed precision=true NAX path on M5, which truncates float32 inputs toward zero to a 10-bit TF32-like mantissa rel L2 = 7.68e-4 vs FP64 . - IEEE float16 round-to-nearest-even EqFP16-NAX returned 1.0009765625 rel L2 = 2.93e-4 vs FP64 , 2.6× lower error than truncate-to-zero TF32 . - Strict IEEE-754 float32 NAX relaxed precision=false runs at 11.2–14.8 TFLOP/s on M5 Max. Below we compare against both baselines explicitly. | Mode / Path | Shape & Dtype | Baseline vs | Effective TFLOP/s | Actual HW Ops/s | Wall-Clock Gain | Measured rel L2 vs FP64 | |---|---|---|---|---|---|---| | fast matmul fp64 CRT S=14 + Smirnov | 9216³ fp64 | CPU Accelerate FP64 0.49 TF | 6.79 TF | 70.4 TOPS INT8 | 13.73× | 5.91e-15 15-digit IEEE | | mode="strict fp32" CRT S=7 + Smirnov | 9216³ fp32 | NAX strict fp32 11.24 TF | 14.16 TF | 73.4 TOPS INT8 | +26.0% up to +46% | 3.82e-7 strict IEEE | | mode="high prec" Ozaki-2 2-slice | 4096³ fp32 | MLX relaxed fp32 40.3 TF | ~48 TF | ~144 TOPS INT8 | ~+19% | 8.23e-5 9.3× < MLX M5 | | mode="no quant" EqFP16-NAX | 4096×4096×14336 fp32 | MLX relaxed fp32 34.6 TF | 48.83 TF | 48.83 TF FP16 | +41.3% | 2.93e-4 2.6× < MLX M5 | | mode="no quant" Smirnov336 , 40/54 | 15360³ bf16 | MLX bf16 52.16 TF | 68.99 TF | 51.10 TF FP16 | +32.3% | 1.83e-3 MLX bf16 : 1.66e-3 | | mode="no quant" Smirnov336 , 40/54 | 18432³ fp16 | MLX fp16 46.16 TF | 68.86 TF | 51.01 TF FP16 | +49.2% | 8.35e-4 MLX fp16 : 2.07e-4 | | Experimental: Kronecker-280 280/432 | 24576³ fp16 | MLX fp16 42.37 TF | 77.00 TF | 49.91 TF FP16 | +81.7% | 1.68e-3 | | Mode / Path | Workload & Dtype | Baseline MLX bf16 | Effective TFLOP/s | Actual HW Ops/s | Wall-Clock Gain | Measured rel L2 / Cosine | |---|---|---|---|---|---|---| | mode="fast train" DB-RHT-INT8-NAX | 11-workload geomean NT/NN/TN bf16 | 40–59 TF | 75–110.5 TF | 75–110.5 TOPS | +38% to +43% | 1.19e-2 cos=0.99993 | | mode="fast train" 21-GEMM 8B layer | Full Llama-3-8B fwd+bwd linear ops bf16 | 110.72 ms | 68.24 TF | 68.24 TOPS | +41.0% 1.41× | 1.19e-2 cos=0.99993 | | Experimental: mode="experimental ultra" | 18432³ bf16 Smirnov-40 INT8 | 48.50 TF | 129.09 TF | 95.62 TOPS | +166.2% 2.66× | 3.09e-2 cos=0.99952 | | Experimental: Kronecker-280 INT8 | 24576³ bf16 280/432 INT8 | 42.26 TF | 131.50 TF | 85.23 TOPS | +211.2% 3.11× | 6.19e-2 cos=0.99809 | - Full Qwen3-style LLM Training Step examples/bench llm e2e step.py , via tachyonize model : Includes RMSNorm, QK-Norm, RoPE, fused causal SDPA, SwiGLU MLP, cross-entropy loss, full backward pass, and fp32 AdamW update: - 760m-wide 2L, d=1536, ffn=4096, M=4096 : 43,395 → 45,355 tok/s +4.5% end-to-end; higher on full 24L models where embeddings/LM head amortize . - 1.3b-wide 2L, d=2048, ffn=5632, M=4096 : 29,098 → 32,010 tok/s +10.0% end-to-end . - llama3-8b 1L, d=4096, ffn=14336, M=4096 : 13,172 → 15,878 tok/s +20.5% end-to-end, even without shared-input RHT reuse . - 3-Seed Convergence & Stability 120 AdamW steps, fp32 master weights + bf16 compute : Native 1.8621 ± 0.3305 vs Tachyon 1.8611 ± 0.3092 mean gap -0.0010 , with gradient-norm mean/max matching to within 0.17% 2.339/7.099 vs 2.341/7.097 . - - Real FP64 Linear Solver examples/fp64 iterative refinement.py : Mixed-precision FP32-LU + GPU fast matmul fp64 iterative refinement on dense$4096 \times 4096$ systems converges to full machine precision backward err = 1.32e-16 , rel err = 1.05e-14 ; GPU residual GEMM beats CPU Accelerate FP64 above$N = 4096$ and reaches 12–14× at$6144^3$ –$9216^3$ . See BENCHMARKING.md https://github.com/davedx/mlx-tachyon/blob/main/BENCHMARKING.md for timing methodology & caveats, VERIFICATION.md https://github.com/davedx/mlx-tachyon/blob/main/VERIFICATION.md for 5-seed 95% CI error bars & raw spot checks, and RESEARCH REPORT.md https://github.com/davedx/mlx-tachyon/blob/main/RESEARCH REPORT.md for full derivations. mlx-tachyon/ ├── mlx tachyon/ Installable Python package v0.3.0 │ ├── init .py Public API: fast matmul, fast matmul fp64, FastLinear, tachyonize │ ├── core.py DispatchInfo, max rel err contracts, 3D/batched & safety guards │ ├── hw.py Runtime M5/Metal 4 NAX detection & explicit int32/extent guards │ ├── kernels.py Deterministic cached .metal template loader │ ├── smirnov336.py Auto-compiler for Smirnov <3,3,6; 40 │ ├── modular crt.py Finite-Ring Modular Sub-Cubic CRT-RNS-NAX strict fp32 & fp64 │ ├── kronecker280.py Experimental Register-Fused Kronecker <6,6,12; 280 │ ├── metal/ Readable, diffable .metal headers & kernel templates │ └── third party/ Upstream CeCILL-B Smirnov <3,3,6; 40 program & license ├── tests/ 25 unit & property-based tests + error-bar report runner │ ├── error metrics.py Full-matrix bias/stddev/quantiles, 95% CI & raw sampling │ ├── test correctness.py All modes, layouts, dtypes, gradients & adversarial inputs │ ├── test properties.py All remainders mod 3/6/12/24/48/64/128, contracts & guards │ └── verify report.py CLI runner python3 -m tests.verify report ├── examples/ Real end-to-end application benchmarks │ ├── bench llm e2e step.py Full Qwen3-style training step tok/s & 3-seed convergence │ └── fp64 iterative refinement.py Mixed-precision FP32-LU + GPU FP64 iterative refinement solver ├── benchmarks/ MLX baseline & DCE-proof M5 Max silicon probes ├── experiments/ All 14 chronological research & prototype scripts ├── results/ Raw JSON benchmark & training logs ├── BENCHMARKING.md How performance is measured, DCE guards & caveats ├── VERIFICATION.md Unit test results, 95% CI error bars & raw spot checks ├── RESEARCH REPORT.md Full technical report & roofline analysis ├── NOTICE Third-party software & academic attributions ├── LICENSE MIT License └── pyproject.toml 1. Full 25-test correctness, property-based & 5-seed error-bar suite ~20s GPU python3 -m tests.verify report Include huge 6144x6144x12288 & 9216^3 dispatch tests python3 -m tests.verify report --large --seeds 5 2. Real end-to-end LLM training step & 3-seed stability check python3 examples/bench llm e2e step.py 3. Real FP64 iterative-refinement linear solver demo python3 examples/fp64 iterative refinement.py 4. Baseline & DCE-proof hardware probes python3 benchmarks/benchmark baseline.py python3 benchmarks/probes/probe dce proof.py See NOTICE https://github.com/davedx/mlx-tachyon/blob/main/NOTICE for full software and academic attributions, including the upstream CeCILL-B V1 pure-dyadic Smirnov mlx tachyon/third party/FMMa 3 3 6.m https://github.com/davedx/mlx-tachyon/blob/main/mlx tachyon/third party/FMMa 3 3 6.m by Jean-Guillaume Dumas, Clément Pernet, and Alexandre Sedoglavic jgdumas/Fast-Matrix-Multiplication , based on A. V. Smirnov 2013 , Karstadt & Schwartz 2017/2020 , Ozaki et al. 2012/2025 , Fawzi et al. / AlphaTensor 2022 , and Apple MLX / Metal 4. mlx-tachyon is released under the MIT License LICENSE https://github.com/davedx/mlx-tachyon/blob/main/LICENSE ; included third-party file FMMa 3 3 6.m remains under CeCILL-B V1 Licence CeCILL-B V1-en.txt https://github.com/davedx/mlx-tachyon/blob/main/mlx tachyon/third party/Licence CeCILL-B V1-en.txt .