Ollama or MLX on Mac mini M4 24 GB: which one is faster?
The same small models, served by Ollama and then by MLX (Apple’s engine), on our Mac mini M4 24 GB. Real figures, measured at night with the same method. Latest run : 2 Dec 2026.
In short
- Generation (512-token prompt): MLX 13% slower (median of 4 models).
- Reading a long prompt (8,192 tokens): MLX 1.5% faster (median of 4 models).
- Cold load: MLX 63% shorter.
Generation (tokens/s, 512-token prompt)
OllamaMLX
Reading a long prompt (tokens/s, 8,192 tokens)
OllamaMLX
Measurement details
| Model | Engine | Memory | Load | Prompt (tok/s) | Generation (tok/s) |
|---|---|---|---|---|---|
| Bonsai 2 27B | Ollama (llama.cpp)GGUF Q2_0bonsai-2:27b | 8.8 GB | 10.2 s | 512 : 60.2 2,048 : 61.1 8,192 : 60.7 | 512 : 11.6 2,048 : 11.5 8,192 : 11 |
| Bonsai 2 27B | MLX (Prism ML pack loader)MLX 2 bits g128prism-ml/Ternary-Bonsai-2-27B-mlx-2bit | 16.8 GB | 5,333 ms+48 % MLX | 512 : 53.5 -11 % 2,048 : 53.2 -13 % 8,192 : 52 -14 % | 512 : 7.7 -34 % 2,048 : 8.6 -25 % 8,192 : 8.2 -25 % |
| Gemma 4 E4B | Ollama (its MLX engine)SAFETENSORS nvfp4gemma4:e4b | 9.4 GB | 5,945 ms | 512 : 668.1 2,048 : 652.1 8,192 : 619.8 | 512 : 45.3 2,048 : 28.7 8,192 : 34 |
| Gemma 4 E4B | MLX (mlx-lm)MLX 4 bits g64mlx-community/gemma-4-e4b-it-4bit | 5.2 GB | 1,291 ms+78 % MLX | 512 : 617.8 -8 % 2,048 : 651.5 0 % 8,192 : 630.4 +2 % | 512 : 35.7 -21 % 2,048 : 35 +22 % 8,192 : 33.7 -1 % |
| Qwen3.5 4B | Ollama (its MLX engine)SAFETENSORS nvfp4qwen3.5:4b | 4 GB | 725 ms | 512 : 427 2,048 : 433.1 8,192 : 414.5 | 512 : 29.6 2,048 : 29.1 8,192 : 27.7 |
| Qwen3.5 4B | MLX (mlx-lm)MLX 4 bits g64mlx-community/Qwen3.5-4B-MLX-4bit | 4.4 GB | 897 ms-24 % MLX | 512 : 420.6 -1 % 2,048 : 432.9 0 % 8,192 : 419.9 +1 % | 512 : 39.8 +34 % 2,048 : 39.1 +34 % 8,192 : 36.9 +33 % |
| Qwen3.5 9B | Ollama (its MLX engine)SAFETENSORS nvfp4qwen3.5:9b | 7.6 GB | 4,228 ms | 512 : 222.1 2,048 : 225.7 8,192 : 215 | 512 : 23.3 2,048 : 23.6 8,192 : 23 |
| Qwen3.5 9B | MLX (mlx-lm)MLX 4 bits g64mlx-community/Qwen3.5-9B-MLX-4bit | 7 GB | 845 ms+80 % MLX | 512 : 226.6 +2 % 2,048 : 233.5 +3 % 8,192 : 233.8 +9 % | 512 : 22.2 -5 % 2,048 : 22 -7 % 8,192 : 21.3 -7 % |
Speeds in tokens per second, median of 3 runs, for each prompt size (“2,048:” = a prompt of about 2,048 tokens). The percentage next to an MLX figure is the gap with Ollama (positive = MLX faster).
Method
- Same model, closest quantization: for Ollama, the model as served by the Ollama library (format and quantization shown on each row); for MLX, the 4-bit version from the mlx-community on Hugging Face (repository shown). The formats are never bit-for-bit identical: this is the real choice a user faces. Note: since its 0.40 releases, Ollama serves some models in safetensors format (shown under the engine) with its own MLX engine; the others (GGUF) go through llama.cpp.
- Same machine, same time: Mac mini M4 24 GB, only one model loaded at a time (Ollama emptied before each MLX run), at night, with our other services (Phonon, Whisper) running.
- Same text: for each prompt size (about 512, 2,048, 8,192 tokens), the same pseudo-random English text (fixed seed), prefixed with a unique marker so that no cache helps, sent through the model’s chat template; thinking off; temperature 0; up to 128 generated tokens; 3 runs, median.
- Prompt and generation speed: tokens / time, as reported by the engine itself (Ollama: API timings; MLX: mlx-lm
stream_generatefigures). One short warm-up run is not counted for MLX (Metal kernel compilation). - Load: model already on disk, loaded cold, wall-clock time measured by our agent. Ollama: from the load request to the “ready” answer. MLX:
load()time until weights are in memory. - Memory: Ollama = loaded model size according to Ollama, with a 16,384-token context reserved up front. MLX = peak Metal memory during the runs (weights + cache of the longest prompt). The two figures do not measure exactly the same thing: compare them with care.
- Bonsai 2 27B (measured 2 Dec 2026): no mlx-community version; this is Prism ML’s official MLX pack (prism-ml/Ternary-Bonsai-2-27B-mlx-2bit, ternary weights stored in 2 bits), read with the loader shipped in the pack and its pinned versions (MLX 0.32.0, mlx-lm 0.31.3): mlx-lm alone cannot read it. Same text, same settings, prompt read in 2,048-token blocks like mlx-lm.
- Versions: Ollama 0.40.11, MLX 0.32.5, mlx-lm 0.32.3.dev8+g0d4d3d04f. MCP tool-calling tests (Small models page) are still run with Ollama, except one screening test of Bonsai 2 27B with MLX (screening section).