Can I run Gemma 4 12B on the Apple M4 Pro?
Runs wellQ4_K_M fits in unified memory (7.8 of 16.8 GB usable by the GPU): Runs well, est. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%).
24 GB unified memory · 273.0 GB/s · FP16 8.1 TFLOPS. Assumes 8k context and an f16 KV cache. Verdicts are shown for each memory size.
Verdict by memory size
The page uses the 24 GB configuration; here is every size.
- 24 GBRuns wellest. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%)Try IQ4_XS: Runs great(used on this page)
- 48 GBRuns wellest. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%)Try IQ4_XS: Runs great
- 64 GBRuns wellest. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%)Try IQ4_XS: Runs great
Every quant of Gemma 4 12B on the Apple M4 Pro
| Quant | File size | Verdict | Speed | Memory | Runs as | Notes |
|---|---|---|---|---|---|---|
| UD-Q2_K_XL | 4.66 GB | Runs great | est. 43.3 tok/s34.6–51.9calibrated estimate ±20% | 5.4 / 16.8 GB | Unified memory | — |
| IQ4_XS | 6.38 GB | Runs great | est. 31.9 tok/s25.5–38.2calibrated estimate ±20% | 7.1 / 16.8 GB | Unified memory | — |
| Q4_K_Mbaseline | 7.12 GB | Runs well | est. 28.6 tok/s22.9–34.3calibrated estimate ±20% | 7.8 / 16.8 GB | Unified memory | — |
| Q8_0 | 12.67 GB | Runs well | est. 16.2 tok/s13.0–19.4calibrated estimate ±20% | 13.4 / 16.8 GB | Unified memory | — |
Models with a thinking mode spend extra tokens thinking, so their speed thresholds are 1.5× stricter (30 / 12 / 3 tok/s). With thinking turned off, a model may do one grade better.
Where the memory goes at Q4_K_M
- Weights
- 7.1 GB
- KV cache
- 0.1 GB
- Compute buffer
- 0.6 GB
- Free
- 9.0 GB
- Not usable by the GPU
- 7.2 GB
Context length vs. KV cache
| Context | KV f16 | KV q8_0 | KV q4_0 |
|---|---|---|---|
| 4k | 7.7 GBRuns well est. 28.9 tok/s23.1–34.6calibrated estimate ±20% | 7.7 GBRuns well est. 29.0 tok/s23.2–34.8calibrated estimate ±20% | 7.7 GBRuns well est. 29.1 tok/s23.2–34.9calibrated estimate ±20% |
| 8k | 7.8 GBRuns well est. 28.6 tok/s22.9–34.3calibrated estimate ±20% | 7.8 GBRuns well est. 28.8 tok/s23.1–34.6calibrated estimate ±20% | 7.7 GBRuns well est. 29.0 tok/s23.2–34.8calibrated estimate ±20% |
| 16k | 8.0 GBRuns well est. 28.1 tok/s22.5–33.7calibrated estimate ±20% | 7.9 GBRuns well est. 28.6 tok/s22.9–34.3calibrated estimate ±20% | 7.8 GBRuns well est. 28.8 tok/s23.1–34.6calibrated estimate ±20% |
| 32k | 8.5 GBRuns well est. 27.1 tok/s21.7–32.5calibrated estimate ±20% | 8.2 GBRuns well est. 28.0 tok/s22.4–33.6calibrated estimate ±20% | 8.1 GBRuns well est. 28.5 tok/s22.8–34.2calibrated estimate ±20% |
| 64k | 9.3 GBRuns well est. 25.3 tok/s20.3–30.4calibrated estimate ±20% | 8.8 GBRuns well est. 27.0 tok/s21.6–32.4calibrated estimate ±20% | 8.5 GBRuns well est. 27.9 tok/s22.4–33.5calibrated estimate ±20% |
| 128k | 11.0 GBRuns well est. 22.4 tok/s17.9–26.9calibrated estimate ±20% | 10.0 GBRuns well est. 25.1 tok/s20.1–30.1calibrated estimate ±20% | 9.4 GBRuns well est. 26.8 tok/s21.5–32.2calibrated estimate ±20% |
| 256k | 14.3 GBRuns well est. 18.2 tok/s14.5–21.8calibrated estimate ±20% | 12.3 GBRuns well est. 22.0 tok/s17.6–26.4calibrated estimate ±20% | 11.2 GBRuns well est. 24.9 tok/s19.9–29.8calibrated estimate ±20% |
S = Runs great · A = Runs well · B = Runs slowly · F = Won't run
At Q4_K_M the verdict stays Runs well up to 256k context with an f16 KV cache, and up to 256k with q8_0.
Estimated speed
- Generation
- est. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%)
- Prompt processing
- about 265 tok/s (159–371, rough estimate ±40%)
Measured on this exact combination
No public measurement for this exact combination yet; the numbers above are estimates.
If this is not enough
A larger model that also runs well on the Apple M4 Pro
Runs wellMistral Small 3.2 24B: Runs well, est. 13.2 tok/s (10.6–15.9, calibrated estimate ±20%)
A lower quant of Gemma 4 12B
Runs greatIQ4_XS (6.38 GB): Runs great, est. 31.9 tok/s (25.5–38.2, calibrated estimate ±20%)
Gemma 4 12B on the Apple M5 Pro
Runs greatQ4_K_M: Runs great, est. 32.2 tok/s (25.7–38.6, calibrated estimate ±20%)
How to run it
Commands for the Q4_K_M file. Both tools download from Hugging Face on first run.
File: gemma-4-12b-it-Q4_K_M.gguf (7.12 GB) from unsloth/gemma-4-12b-it-GGUF.
llama-server -hf unsloth/gemma-4-12b-it-GGUF:Q4_K_M -c 8192 -ngl all -fa on- -ngl all loads every layer on the GPU.
- -fa on enables flash attention (needed for KV cache quantization).
- --cache-type-k q8_0 --cache-type-v q8_0 shrinks the KV cache to 0.07 GB at 8k context.
Terminal:
OLLAMA_CONTEXT_LENGTH=8192 ollama serve
ollama run hf.co/unsloth/gemma-4-12b-it-GGUF:Q4_K_M- Ollama defaults to 4k context on GPUs under 24 GB. Set OLLAMA_CONTEXT_LENGTH when starting the server, or /set parameter num_ctx inside the chat.
/set parameter num_ctx 8192
Related pages
Guide: Running local LLMs on a Mac (M4, M5): how much unified memory?
Other models on the Apple M4 Pro
Gemma 4 12B on other hardware
Frequently asked questions
Can I run Gemma 4 12B on the Apple M4 Pro?
Q4_K_M fits in unified memory (7.8 of 16.8 GB usable by the GPU): Runs well, est. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%). Q4_K_M needs 7.8 GB at 8k context; the GPU can use 16.8 GB of the unified memory.
How much context can Gemma 4 12B use on the Apple M4 Pro?
At Q4_K_M the verdict stays Runs well up to 256k context with an f16 KV cache (4.3 GB of KV) and up to 256k with a q8_0 KV cache (2.3 GB). The model supports up to 256k.
Which quant should I use, and how fast is it?
Q4_K_M (7.12 GB) is the recommended balance: Runs well, est. 28.6 tok/s (22.9–34.3, calibrated estimate ±20%). The largest tracked file that still gets Runs well is Q8_0 (12.67 GB), est. 16.2 tok/s (13.0–19.4, calibrated estimate ±20%).
Speeds are estimates from memory bandwidth, calibrated against public benchmarks, and each one comes with an error band and a confidence label. Real results vary with drivers, backend, context length and thermals.