MLX
by Apple · Framework · Text & code
An array and machine-learning framework for Python and other languages that runs and trains neural networks on Apple silicon Macs using unified memory.
Apple-silicon ML framework: compiling gives real speedups, but custom kernels and quantization have gotchas
Latest · Nov 28macOS 26.2 adds RDMA over Thunderbolt; Apple's note says to enable it from recovery mode with a Terminal command, and a user says macOS 27 moves it into Settings.
Who says what
Early daysKrishdeep13, who benchmarked mx.compile
Compiling made a 5-op elementwise chain 4.65x faster (4.80 ms vs 22.33 ms), rising to about 10.9x on long chains, with identical outputs in all 90 tested cases. Softmax and matmul+gelu gained nothing, and the first compiled call varied from 7 ms to 273 ms.
MLX: Show and tell and rizumita, who hit its limits
MLX: Show and tell found custom kernels copy non-contiguous arrays on every call (about 9 ms for 1M x 128) and always allocate new outputs. rizumita found mx.quantize in 0.31.1 returns negative scales, breaking code that assumes positive ones.
Apple, and Jorge Marfil reporting on Mac clusters
Apple claims two M5 Ultras speed a 65,536-token prefill about 1.8x. Marfil reports no Thunderbolt 5 switches exist, so every Mac must be cabled to every other.
What would settle it. An independent test of the multi-Mac setup Apple describes, timing real prefill and generation.
Seen running on
| Machine | Speed | How | Seen by |
|---|---|---|---|
| 1 run on a 24 GB Mac | |||
| float32 | |||
Evidence
- Nov 28mx.compile ran a 5-op elementwise chain on 2^27 float32 in 4.80 ms versus 22.33 ms eager, 4.65x faster with identical outputsHands-on test
Krishdeep13 - Nov 28mx.compile speedup on elementwise chains grew from 1.90x at 1 step to 10.87x at 128 steps, plateauing near 10.6-10.9x from 32 stepsHands-on test
Krishdeep13 - Nov 28At 4096x4096, compile sped up where by about 4.6-4.9x and layernorm by about 1.3x, but softmax and matmul+gelu stayed about 1.0xHands-on test
Krishdeep13 - Nov 28Compiled time rose in steps after 11, 22 and 33 ops, consistent with MLX's max_compile_depth of 11; author says this is not proofHands-on test
Krishdeep13 - Nov 28First mx.compile call varied from about 7 ms to 273 ms across runs versus a steady 4.8 ms afterwards; cause not foundHands-on test
Krishdeep13
Show all 12
- Nov 28Compiled and eager outputs matched exactly (max difference 0.0) in all 90 tested cases of functions, dtypes and shapesHands-on test
Krishdeep13 - Nov 25In MLX 0.31.1, mx.quantize in affine mode returns negative scales for blocks where |min| > |max|; code assuming positive scales gives wrong rounding statistics.Hands-on test
rizumita - Nov 19Apple reports pipeline parallelism on two M5 Ultras speeds a 65,536-token prefill about 1.8x; tensor parallelism needs low-latency RDMA, and two cables per link cut one test from 50.5 s to 40.6 s.Maker's claimApplevia
Jorge Marfil - Nov 19Gurman says no Thunderbolt 5 switches exist, so each Mac must be cabled to every other; Apple cables cost $70 each.Reported
Jorge Marfil - Nov 12mx.array from a NumPy view keeps its strides; with ensure_row_contiguous=True a custom kernel copies the whole array each call, about 9 ms for 1M x 128Hands-on test
MLX: Show and tell - Nov 12With MTL_SHADER_VALIDATION=1, Metal counts threadgroup memory twice, so a kernel fitting in 32 KB fails validation above 16 KBHands-on test
MLX: Show and tell - Nov 12Custom kernel outputs are always new arrays, forcing per-round allocation in NN-Descent; asks whether in-place state updates across iterations could be supportedHands-on test
MLX: Show and tell