cd /news/machine-learning/up-to-211-faster-matrix-multiplicati… Β· home β€Ί topics β€Ί machine-learning β€Ί article
[ARTICLE Β· art-180864] src=github.com β†— pub= topic=machine-learning verified=true sentiment=↑ positive

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.

recommendation

On Apple M5 hardware, route dense fp16/bf16 GEMMs through mlx-tachyon's no_quant mode and fp64 work through fast_matmul_fp64 to gain up to 49% and 13.7Γ— respectively, keeping the mx.matmul fallback for M1–M4.

more in playbook: Inference and self-hosting
read9 min views9 publishedDec 3, 2026
Up to 211% faster matrix multiplication on modern Apple Silicon
Image: Michielbdejong (auto-discovered)

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 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:

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 vsFP64 ,+29% to+41% faster than MLX's default relaxedfloat32 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 to69.0 effective TFLOP/s (51.1 actual hardware TFLOP/s) on$15360^3$ bfloat16 /float16 (+30% to+49% wall-clock speedup overmx.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-coprimeodd 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) and15-digit IEEE-754 float64 ( rel_L2 = 5.91e-15 ,max|err| = 9.38e-16 ) at5.9–6.8 effective TFLOP/s (12.2×–13.7Γ— faster than Apple M5 Max CPU AccelerateFP64 on$6144^3$ –$9216^3$!).
  1. Executes pure-dyadic Smirnov

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%** (2L1.3B ) to**+20.5%** (1L8B ) with identical 3-seed loss (mean_gap = -0.0010 ) and gradient norms.
  1. Maps

High-precision 2-slice Ozaki (mode="high_prec"): - 2-slice residual RHT-INT8 ( rel_L2 = 8.23e-5 vsFP64 ), ~9.3Γ— closer toFP64 than MLX's default relaxedfloat32 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 AccelerateFP64
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 MLXfp16 /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:

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)

C, info = fast_matmul(A, B, layout="NT", max_rel_err=1e-3, return_info=True)
print(info)

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)

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

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, whichtruncates float32 inputs toward zero to a 10-bit TF32-like mantissa (rel_L2 = 7.68e-4 vsFP64 ).
  • IEEE float16 round-to-nearest-even (EqFP16-NAX) returned 1.0009765625 ( rel_L2 = 2.93e-4 vsFP64 , 2.6Γ— lower error than truncate-to-zero TF32).
  • Strict IEEE-754 float32 NAX (relaxed_precision=false ) runs at11.2–14.8 TFLOP/s on M5 Max. Below we compare againstboth 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, andfp32 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): Native1.8621 Β± 0.3305 vs Tachyon1.8611 Β± 0.3092 (mean gap -0.0010 ), with gradient-norm mean/max matching to within0.17% (2.339/7.099 vs2.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 reaches12–14Γ— at$6144^3$ –$9216^3$).

See BENCHMARKING.md for timing methodology & caveats, VERIFICATION.md for 5-seed 95% CI error bars & raw spot checks, and 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 
β”‚   β”œβ”€β”€ 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
python3 -m tests.verify_report

python3 -m tests.verify_report --large --seeds 5

python3 examples/bench_llm_e2e_step.py

python3 examples/fp64_iterative_refinement.py

python3 benchmarks/benchmark_baseline.py
python3 benchmarks/probes/probe_dce_proof.py

See 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) 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); included third-party file FMMa_3_3_6.m remains under CeCILL-B V1 (Licence_CeCILL-B_V1-en.txt).

── more in #machine-learning 4 stories Β· sorted by recency
── more on @mlx-tachyon 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/up-to-211-faster-mat…] indexed:0 read:9min 2026-12-03 Β· β€”