# Gemma 4 31B: hardware requirements
> Gemma 4 31B (Google) is a 31B dense model with a 256K-token context window, released under the Apache 2.0 license. It needs about 22GB of memory at Q4_K_M with 8K context.
Gemma 4 31B is Google's flagship open model, a dense 31B with image input, a 256K context, a thinking mode, and an Apache 2.0 license. It is the strongest Gemma yet and a well-rounded choice for writing, multilingual chat, vision, and coding, though Qwen3.8 27B scores higher on reasoning and agentic benchmarks. At Q4_K_M it needs about 21.5GB with 8K context plus a fixed buffer of about 1GB for its sliding-window layers, which fits a 24GB GPU with a modest context; a 32GB RTX 5090 or a Mac with 36GB or more is more comfortable. As a dense model it is slower than Gemma 4 26B A4B on the same hardware.

## Recommended hardware
- **Minimum GPU:** RTX 4000 Ada (20GB), Q3_K_M, ~18 tokens/sec
- **Best value:** RTX 5090 (32GB), Q5_K_M, ~59 tokens/sec
- **Fastest single GPU:** RTX 5090 (32GB), Q5_K_M, ~59 tokens/sec
- **Mac / unified memory:** Ryzen AI Max+ 395 (128GB), Q8_0, ~5.8 tokens/sec

## Memory by quantization
| Quant | Weights | Total @ 8K ctx | Total @ 32K ctx |
| --- | --- | --- | --- |
| Q2_K | 12.1GB | 14.8GB | 16.8GB |
| Q3_K_M | 15.8GB | 18.5GB | 20.5GB |
| Q4_K_M | 19.6GB | 22.5GB | 24.5GB |
| Q5_K_M | 23.0GB | 26.0GB | 28.0GB |
| Q6_K | 26.7GB | 29.7GB | 31.8GB |
| Q8_0 | 32.6GB | 35.9GB | 37.9GB |
| BF16 | 61.4GB | 65.5GB | 67.5GB |

## GPUs that run it fully in memory (fastest first)
| GPU | Memory | Quant | Speed | Price |
| --- | --- | --- | --- | --- |
| RTX 5090 | 32GB | Q5_K_M | ~59 tok/s | ~$4,300 |
| RTX PRO 6000 | 96GB | Q8_0 | ~42 tok/s | ~$16,000 |
| RTX 4090 | 24GB | Q4_K_M | ~40 tok/s | ~$2,500 used |
| RTX 3090 | 24GB | Q4_K_M | ~33 tok/s | ~$1,050 used |
| RTX PRO 5000 72GB | 72GB | Q8_0 | ~32 tok/s | ~$9,100 |
| RX 7900 XTX | 24GB | Q4_K_M | ~30 tok/s | ~$1,050 used |
| V100 32GB | 32GB | Q5_K_M | ~25 tok/s | ~$700 used |
| RTX 6000 Ada | 48GB | Q8_0 | ~23 tok/s | ~$4,750 used |
| M5 Ultra 512GB | 512GB | Q8_0 | ~20 tok/s | n/a |
| M5 Ultra 256GB | 256GB | Q8_0 | ~20 tok/s | ~$9,499 |
| MI50 32GB | 32GB | Q5_K_M | ~19 tok/s | ~$600 used |
| RTX 4000 Ada | 20GB | Q3_K_M | ~18 tok/s | $1,250 MSRP |
| R9700 | 32GB | Q5_K_M | ~18 tok/s | ~$1,800 |
| RTX A6000 | 48GB | Q8_0 | ~17 tok/s | ~$4,400 used |
| Arc Pro B70 | 32GB | Q5_K_M | ~14 tok/s | ~$1,300 |
| M3 Ultra 512GB | 512GB | Q8_0 | ~14 tok/s | $9,499 MSRP |
| Arc Pro B60 | 24GB | Q4_K_M | ~12 tok/s | ~$650 |
| M5 Max 128GB | 128GB | Q8_0 | ~12 tok/s | ~$5,100 |
| M4 Max 128GB | 128GB | Q8_0 | ~11 tok/s | $3,499 MSRP |
| Tesla P40 | 24GB | Q4_K_M | ~9.6 tok/s | ~$230 used |
| DGX Spark | 128GB | Q8_0 | ~6.2 tok/s | ~$6,950 |
| Ryzen AI Max+ PRO 495 | 192GB | Q8_0 | ~6.2 tok/s | ~$6,800 |
| Ryzen AI Max+ 395 | 128GB | Q8_0 | ~5.8 tok/s | ~$3,300 |

## How to run it
- Ollama: `ollama run gemma4:31b`
- llama.cpp: `llama-server -hf unsloth/gemma-4-31B-it-GGUF:Q4_K_M -c 8192 -ngl 99`
- Weights: https://huggingface.co/google/gemma-4-31B-it

## Strengths
- Excellent writing, multilingual chat, and image understanding
- Thinking mode and 256K context
- Compact long-context KV cache for a dense 31B model
- Apache 2.0 license

## Weaknesses
- Tight on 24GB GPUs at Q4_K_M once context grows
- Slower than mixture-of-experts models of similar quality
- Trails Qwen3.8 27B on reasoning and agentic coding benchmarks
Full page: https://llamabuilds.ai/models/gemma-4-31b · Hardware guide: https://llamabuilds.ai/models/gemma-4-31b/requirements

---
Source: https://llamabuilds.ai/models/gemma-4-31b · Updated October 14, 2026 · Llama Builds. Speeds marked ~ are estimates from our bandwidth model (https://llamabuilds.ai/methodology); measured results are labeled as such.
