MLX vs llama.cpp vs Ollama on M4 Max
Observed decode, prefill and memory results from our M4 Max 64 GB test machine. Each row retains its model encoding and effective context.
Coverage on the test rig
The latest export contains 70 workloads on this Mac. 8 models have observations from at least two backends. The matrices below include only those models.
For a controlled speed comparison, match the model artifact and precision, output length, prompt, context, batch and protocol. New Phase 2 runs use shared windows of 640, 4,224 and 16,512 tokens across all three engines. Earlier Ollama and MLX observations include 8,192- and 32,768-token windows. Compare rows within the same window and account for different tensors in MLX and GGUF artifacts.
| Backend | Latest workloads | Successful | Out of memory | Runtime errors |
|---|---|---|---|---|
| mlx | 24 | 24 | 0 | 0 |
| llama.cpp | 22 | 22 | 0 | 0 |
| ollama | 24 | 24 | 0 | 0 |
Qwen3-30B-A3B
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx4bit | 131.0 tok/sMedian decode · 640 · shared windowPrefill 1,575.8 tok/s · peak 17.8 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | 116.2 tok/sMedian decode · 4,224 · shared windowPrefill 1,720.9 tok/s · peak 18.3 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | 83.1 tok/sMedian decode · 16,512 · shared windowPrefill 1,069.3 tok/s · peak 19.4 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 |
| llama.cppQ4_K_M | 134.4 tok/sMedian decode · 640 · shared windowPrefill 1,615.8 tok/s · peak 18.9 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | 109.1 tok/sMedian decode · 4,224 · shared windowPrefill 1,359.6 tok/s · peak 19.6 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | 74.9 tok/sMedian decode · 16,512 · shared windowPrefill 814.1 tok/s · peak 22.0 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) |
| ollamaQ4_K_M | 122.9 tok/sMedian decode · 8,192 · legacy windowPrefill 1,655.1 tok/s · peak 19.6 GB2026-11-29 UTC · 0.40.16 | 106.2 tok/sMedian decode · 8,192 · legacy windowPrefill 1,484.8 tok/s · peak 19.7 GB2026-11-29 UTC · 0.40.16 | 73.7 tok/sMedian decode · 32,768 · legacy windowPrefill 860.2 tok/s · peak 22.1 GB2026-11-29 UTC · 0.40.16 |
gpt-oss-20b
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlxMXFP4-Q4 | 150.0 tok/sMedian decode · 640 · shared windowPrefill 1,719.5 tok/s · peak 11.7 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 149.7 tok/sMedian decode · 8,192 · legacy windowPrefill 1,650.2 tok/s · peak 11.7 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | 142.9 tok/sMedian decode · 4,224 · shared windowPrefill 1,783.2 tok/s · peak 12.1 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 142.2 tok/sMedian decode · 8,192 · legacy windowPrefill 1,777.2 tok/s · peak 12.1 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | 124.2 tok/sMedian decode · 16,512 · shared windowPrefill 1,575.2 tok/s · peak 12.4 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 124.1 tok/sMedian decode · 32,768 · legacy windowPrefill 1,573.9 tok/s · peak 12.4 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 |
| llama.cppMXFP4 | 133.8 tok/sMedian decode · 640 · shared windowPrefill 1,743.5 tok/s · peak 12.4 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | 128.5 tok/sMedian decode · 4,224 · shared windowPrefill 1,691.8 tok/s · peak 12.6 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | 114.5 tok/sMedian decode · 16,512 · shared windowPrefill 1,380.8 tok/s · peak 13.2 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) |
| ollamaMXFP4 | 102.8 tok/sMedian decode · 640 · shared windowPrefill 1,654.9 tok/s · peak 14.1 GB2026-11-29 UTC · 0.40.16 102.8 tok/sMedian decode · 8,192 · legacy windowPrefill 1,657.7 tok/s · peak 14.3 GB2026-11-29 UTC · 0.40.16 | 100.1 tok/sMedian decode · 4,224 · shared windowPrefill 1,781.5 tok/s · peak 14.2 GB2026-11-29 UTC · 0.40.16 99.8 tok/sMedian decode · 8,192 · legacy windowPrefill 1,782.5 tok/s · peak 14.3 GB2026-11-29 UTC · 0.40.16 | 89.1 tok/sMedian decode · 16,512 · shared windowPrefill 1,455.7 tok/s · peak 14.6 GB2026-11-29 UTC · 0.40.16 91.1 tok/sMedian decode · 32,768 · legacy windowPrefill 1,455.1 tok/s · peak 15.0 GB2026-11-29 UTC · 0.40.16 |
Llama-3.1-8B-Instruct
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx4bit | 90.9 tok/sMedian decode · 8,192 · legacy windowPrefill 836.1 tok/s · peak 5.1 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| llama.cppQ4_K_M | 80.1 tok/sMedian decode · 640 · shared windowPrefill 836.0 tok/s · peak 5.3 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| ollamaQ4_K_M | 78.8 tok/sMedian decode · 8,192 · legacy windowPrefill 842.0 tok/s · peak 6.2 GB2026-11-29 UTC · 0.40.16 | Not measured | Not measured |
DeepSeek-R1-Distill-Qwen-7B
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx4bit | 95.8 tok/sMedian decode · 8,192 · legacy windowPrefill 902.4 tok/s · peak 4.9 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| llama.cppQ4_K_M | 84.4 tok/sMedian decode · 640 · shared windowPrefill 890.0 tok/s · peak 4.9 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| ollamaQ4_K_M | 83.9 tok/sMedian decode · 8,192 · legacy windowPrefill 901.7 tok/s · peak 5.3 GB2026-11-29 UTC · 0.40.16 | Not measured | Not measured |
gemma-3-4b-it
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx4bit | 148.4 tok/sMedian decode · 8,192 · legacy windowPrefill 1,643.0 tok/s · peak 3.4 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| llama.cppQ8_0 | 87.2 tok/sMedian decode · 640 · shared windowPrefill 1,785.4 tok/s · peak 4.5 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ5_K_M | 104.3 tok/sMedian decode · 640 · shared windowPrefill 1,719.4 tok/s · peak 3.2 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ4_K_M | 131.9 tok/sMedian decode · 640 · shared windowPrefill 1,837.1 tok/s · peak 2.8 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| ollamaQ4_K_M | 117.3 tok/sMedian decode · 8,192 · legacy windowPrefill 1,646.1 tok/s · peak 4.0 GB2026-11-29 UTC · 0.40.16 | Not measured | Not measured |
Qwen3-4B
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx8bit | 88.4 tok/sMedian decode · 8,192 · legacy windowPrefill 1,493.4 tok/s · peak 4.8 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| mlx4bit | 159.6 tok/sMedian decode · 8,192 · legacy windowPrefill 1,642.6 tok/s · peak 3.0 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| llama.cppQ8_0 | 85.0 tok/sMedian decode · 640 · shared windowPrefill 1,568.5 tok/s · peak 4.6 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ5_K_M | 103.2 tok/sMedian decode · 640 · shared windowPrefill 1,512.4 tok/s · peak 3.2 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ4_K_M | 134.3 tok/sMedian decode · 640 · shared windowPrefill 1,615.3 tok/s · peak 2.9 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| ollamaQ4_K_M | 117.5 tok/sMedian decode · 8,192 · legacy windowPrefill 1,538.0 tok/s · peak 4.0 GB2026-11-29 UTC · 0.40.16 | Not measured | Not measured |
Qwen3-1.7B
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx8bit | 204.5 tok/sMedian decode · 8,192 · legacy windowPrefill 3,759.3 tok/s · peak 2.4 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| mlx4bit | 313.5 tok/sMedian decode · 8,192 · legacy windowPrefill 3,739.6 tok/s · peak 1.7 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| llama.cppQ8_0 | 188.0 tok/sMedian decode · 640 · shared windowPrefill 4,036.6 tok/s · peak 2.5 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ5_K_M | 207.5 tok/sMedian decode · 640 · shared windowPrefill 3,610.7 tok/s · peak 1.8 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ4_K_M | 248.9 tok/sMedian decode · 640 · shared windowPrefill 3,838.7 tok/s · peak 1.6 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| ollamaQ4_K_M | 225.4 tok/sMedian decode · 8,192 · legacy windowPrefill 3,970.8 tok/s · peak 2.5 GB2026-11-29 UTC · 0.40.16 | Not measured | Not measured |
Qwen3-0.6B
Model and device details| Backend / quantization | 512 input tokens | 4,096 input tokens | 16,384 input tokens |
|---|---|---|---|
| mlx4bit | 451.1 tok/sMedian decode · 8,192 · legacy windowPrefill 7,091.1 tok/s · peak 0.8 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | 359.9 tok/sMedian decode · 8,192 · legacy windowPrefill 8,723.1 tok/s · peak 1.6 GB2026-11-28 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | 171.8 tok/sMedian decode · 32,768 · legacy windowPrefill 4,470.3 tok/s · peak 3.0 GB2026-11-28 UTC · mlx-lm 0.32.2 / mlx 0.32.5 |
| mlx8bit | 401.7 tok/sMedian decode · 8,192 · legacy windowPrefill 8,623.1 tok/s · peak 1.2 GB2026-11-29 UTC · mlx-lm 0.32.2 / mlx 0.32.5 | Not measured | Not measured |
| llama.cppQ8_0 | 305.7 tok/sMedian decode · 640 · shared windowPrefill 9,177.1 tok/s · peak 0.9 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | 258.1 tok/sMedian decode · 4,224 · shared windowPrefill 7,361.5 tok/s · peak 1.8 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | 143.6 tok/sMedian decode · 16,512 · shared windowPrefill 3,408.6 tok/s · peak 4.6 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) |
| llama.cppQ5_K_M | 342.8 tok/sMedian decode · 640 · shared windowPrefill 8,327.2 tok/s · peak 0.9 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| llama.cppQ4_K_M | 367.4 tok/sMedian decode · 640 · shared windowPrefill 8,785.8 tok/s · peak 0.8 GB2026-11-29 UTC · 1.1.0 (build 12774, commit 171527522) | Not measured | Not measured |
| ollamaQ4_K_M | 323.7 tok/sMedian decode · 8,192 · legacy windowPrefill 9,078.3 tok/s · peak 1.6 GB2026-11-29 UTC · 0.40.16 | 267.5 tok/sMedian decode · 8,192 · legacy windowPrefill 7,596.4 tok/s · peak 1.6 GB2026-11-28 UTC · 0.40.16 | 145.8 tok/sMedian decode · 32,768 · legacy windowPrefill 3,520.7 tok/s · peak 4.5 GB2026-11-28 UTC · 0.40.16 |
Frequently asked questions
Which runtime is fastest on M4 Max?
The ranking depends on the model, its artifact, prompt and context. This report displays observed rates with their encodings and runtime versions. It does not select a cross-format winner.
Why are some cells empty?
A workload needs an observed attempt. Missing runtime and context combinations are labeled Not measured.
Can I compare peak memory across these runtimes?
MLX reports allocations from the MLX memory counter. Sampled process resident memory covers a different set of allocations. Compare peaks within the same reporting method.