Hardware guide · October 2026
What GPU do you need to run Gemma 4 31B?
Gemma 4 31B is a 31B dense model. Here is exactly how much memory it needs and which GPUs and Macs run it well.
The short answer
To run Gemma 4 31B at Q4_K_M with 8K tokens of context you need about 22GB of VRAM (19.6GB of weights plus KV cache and overhead). The cheapest way in is a 20GB card like the RTX 4000 Ada ($1,250 MSRP). For the best speed per dollar, get the RTX 5090 (~59 tokens/sec). On a Mac or other unified-memory system, the Ryzen AI Max+ 395 runs it at ~5.8 tokens/sec.
- VRAM at Q4_K_M
- ~22GB
- GPUs that run it
- 23
- Parameters
- 31B
- CPU only (est.)
- ~2.3 tok/s
Our recommendations
The best GPUs for Gemma 4 31B
Minimum
RTX 4000 Ada20GB · $1,250 MSRP
- Quant
- Q3_K_M
- Speed (est.)
- ~18 tok/s
The smallest card that runs it at Q3_K_M with 8K context.
Best value
RTX 509032GB · ~$4,300
- Quant
- Q5_K_M
- Speed (est.)
- ~59 tok/s
The most tokens per second per dollar among cards with room to spare.
Mac / unified memory
Ryzen AI Max+ 395128GB unified · ~$3,300
- Quant
- Q8_0
- Speed (est.)
- ~5.8 tok/s
Lots of memory per dollar and silent, but slower than a GPU with the same capacity.
We may earn a commission when you buy through links on this page. It never changes what we recommend. How we make money
Memory
Gemma 4 31B VRAM requirements
Memory needed at each quantization level. Q4_K_M is the best balance of size and quality for most people; move up to Q5 or Q6 if you have the room.
| Quantization | Quality | Weights | Total @ 8K ctx | Total @ 32K ctx |
|---|---|---|---|---|
| Q2_K | Rough | 12 GB | 15 GB | 17 GB |
| Q3_K_M | Usable | 16 GB | 19 GB | 21 GB |
| Q4_K_M | RecommendedDefault | 20 GB | 22 GB | 24 GB |
| Q5_K_M | Very good | 23 GB | 26 GB | 28 GB |
| Q6_K | Near-lossless | 27 GB | 30 GB | 32 GB |
| Q8_0 | Practically lossless | 33 GB | 36 GB | 38 GB |
| BF16 | Full precision | 61 GB | 66 GB | 68 GB |
Context
How context length changes the memory you need
Every token in the context window is stored in the KV cache. At Q4_K_M, with a 16-bit KV cache, Gemma 4 31B needs:
| Context | KV cache | Total memory | With 8-bit KV |
|---|---|---|---|
| 4K tokens | 1.3 GB | 22.1 GB | 21.5 GB |
| 8K tokens | 1.7 GB | 22.5 GB | 21.6 GB |
| 16K tokens | 2.3 GB | 23.1 GB | 22.0 GB |
| 32K tokens | 3.7 GB | 24.5 GB | 22.6 GB |
| 64K tokens | 6.4 GB | 27.2 GB | 24.0 GB |
| 128K tokens | 11.7 GB | 32.5 GB | 26.7 GB |
| 256K tokens | 22.5 GB | 43.3 GB | 32.0 GB |
60 layers: 50 sliding-window layers (1,024-token window, 16 KV heads x 256 dims) and 10 global layers (4 KV heads x 512 dims). Only the global layers grow with context: 2 x 10 x 4 x 512 x 2 bytes = 81,920 bytes per token, about 21GB at the full 256K. The sliding layers add a fixed buffer of about 0.8GB to 1.3GB depending on batch size.
Compatibility
Every GPU that runs Gemma 4 31B
Each GPU at the highest-quality quantization that fits with 8K context, fastest first. Speeds are single-user estimates.
| GPU | Memory | Quant | Speed | Fit | Price |
|---|---|---|---|---|---|
| RTX 5090 | 32GB | Q5_K_M | ~59 tok/s | Runs well | ~$4,300 |
| RTX PRO 6000 | 96GB | Q8_0 | ~42 tok/s | Runs well | ~$16,000 |
| RTX PRO 5000 72GB | 72GB | Q8_0 | ~32 tok/s | Runs well | ~$9,100 |
| V100 32GB | 32GB | Q5_K_M | ~25 tok/s | Runs well | ~$700 used |
| RTX 6000 Ada | 48GB | Q8_0 | ~23 tok/s | Runs well | ~$4,750 used |
| M5 Ultra 512GB | 512GB unified | Q8_0 | ~20 tok/s | Runs well | — |
| M5 Ultra 256GB | 256GB unified | Q8_0 | ~20 tok/s | Runs well | ~$9,499 |
| MI50 32GB | 32GB | Q5_K_M | ~19 tok/s | Runs well | ~$600 used |
| R9700 | 32GB | Q5_K_M | ~18 tok/s | Runs well | ~$1,800 |
| RTX A6000 | 48GB | Q8_0 | ~17 tok/s | Runs well | ~$4,400 used |
| Arc Pro B70 | 32GB | Q5_K_M | ~14 tok/s | Runs well | ~$1,300 |
| M3 Ultra 512GB | 512GB unified | Q8_0 | ~14 tok/s | Runs well | $9,499 |
| M5 Max 128GB | 128GB unified | Q8_0 | ~12 tok/s | Runs well | ~$5,100 |
| M4 Max 128GB | 128GB unified | Q8_0 | ~11 tok/s | Runs well | $3,499 |
| Ryzen AI Max+ PRO 495 | 192GB unified | Q8_0 | ~6.2 tok/s | Runs well | ~$6,800 |
| DGX Spark | 128GB unified | Q8_0 | ~6.2 tok/s | Runs well | ~$6,950 |
| Ryzen AI Max+ 395 | 128GB unified | Q8_0 | ~5.8 tok/s | Runs well | ~$3,300 |
| RTX 4090 | 24GB | Q4_K_M | ~40 tok/s | Fits, tight | ~$2,500 used |
| RTX 3090 | 24GB | Q4_K_M | ~33 tok/s | Fits, tight | ~$1,050 used |
| RX 7900 XTX | 24GB | Q4_K_M | ~30 tok/s | Fits, tight | ~$1,050 used |
| RTX 4000 Ada | 20GB | Q3_K_M | ~18 tok/s | Fits, tight | $1,250 |
| Arc Pro B60 | 24GB | Q4_K_M | ~12 tok/s | Fits, tight | ~$650 |
| Tesla P40 | 24GB | Q4_K_M | ~9.6 tok/s | Fits, tight | ~$230 used |
With CPU offload (partial offload, assuming 64GB of system RAM): RTX 5080 (~5.8 tok/s), RTX 5070 Ti (~5.8 tok/s), RTX 4080 Super (~5.6 tok/s), RTX 4070 Ti Super (~5.6 tok/s), RX 9070 XT (~5.4 tok/s), RTX 5060 Ti 16GB (~5.2 tok/s), RTX 4060 Ti 16GB (~4.8 tok/s), RX 9060 XT 16GB (~4.6 tok/s) and 5 more.
Tips
Getting the most out of Gemma 4 31B
- Start at Q4_K_M. It keeps nearly all of the quality at about a third of the 16-bit size. Step up to Q5_K_M or Q6_K only if it still fits with the context you need.
- Budget memory for context. The KV cache grows with every token. Quantizing it to 8-bit roughly halves that cost with little quality loss.
- Avoid heavy CPU offload. For a dense model, every token reads every weight. Once a large share of the model sits in system RAM, speed falls off a cliff. A second GPU usually beats offloading.
- Pick the right runtime. Ollama and LM Studio are easiest. llama.cpp gives the most control. vLLM or SGLang are best when several people or agents share one machine.
Want to try different quantizations, context lengths, or GPU counts? Use our VRAM calculator, or read the Gemma 4 31B overview for setup commands and benchmarks.
Frequently asked questions
How much VRAM do I need to run Gemma 4 31B?
About 22GB at Q4_K_M with an 8K context window. At Q8_0 (near-lossless) it needs about 36GB, and at Q3_K_M about 19GB with some quality loss. Longer contexts add 0.21GB per 1K tokens with a 16-bit KV cache.
Can I run Gemma 4 31B on a 16GB GPU?
Only with partial CPU offload. On a 16GB card like the RTX 5060 Ti 16GB, about 36% of the weights would sit in system RAM and generation drops to about 5.8 tokens/sec with CPU offload.
Can I run Gemma 4 31B on a Mac?
Yes. With 128GB of unified memory or more (for example the Ryzen AI Max+ 395), macOS can give the GPU enough memory to run it at Q8_0, at about ~5.8 tokens/sec. MLX builds are usually fastest on Apple silicon.
Can I run Gemma 4 31B on CPU only, without a GPU?
Yes, if you have at least 32GB of system RAM. On a desktop with dual-channel DDR5, expect roughly 2.3 tokens/sec. A GPU is strongly recommended for interactive use.