How to Deploy Gemma 4 31B Locally
Gemma 4 31B is a dense model with 31.3B parameters. At Q4 it needs at least 26GB of VRAM, and 32GB is the comfortable amount for an 8K context. The cheapest card that runs it today is the Instinct MI50 32GB at about $405, at roughly 23.3 tokens/s.
Gemma 4 31B details
How much VRAM does Gemma 4 31B need for local deployment?
| Quantization | WeightsGB | Total at 8KGB | Total at 32KGB | Total at 128KGB |
|---|---|---|---|---|
| 1-bit | 7.3est. | 15.8 | 38.3 | 128.3 |
| 2-bit | 11.8GGUF | 20.1 | 42.6 | 132.6 |
| 3-bit | 15.4GGUF | 23.5 | 46 | 136 |
| 4-bit | 18.3GGUF | 25.9 | 48.4 | 138.4 |
| 5-bit | 21.7GGUF | 29.6 | 52.1 | 142.1 |
| 8-bit | 32.6GGUF | 40.9 | 63.4 | 153.4 |
| FP16 | 61.4GGUF | 69.7 | 92.2 | 182.2 |
Total = weights + KV cache (FP16) + 1GB runtime overhead. Weights marked GGUF are measured file sizes from the repository; the rest are estimated from bytes per parameter. Contexts beyond this model's 256K limit show a dash. Each tier takes whichever file of that bit width the repository has, preferring unsloth dynamic quants, so the exact file name varies by model.
Which GPUs can run Gemma 4 31B?
Xianyu
| Device | VRAMGB | Price | Est. t/s | Suggested context |
|---|---|---|---|---|
| 32 | $4054 listings | 23.3 | 8K | |
| 32 | $47611 listings | 28.5 | 8K | |
| 32 | $1,4656 listings | 12.6 | 8K | |
| 32 | $1,6438 listings | 14.7 | 8K | |
| 40 | $1,6804 listings | 48.6 | 8K | |
| 32 | $1,8443 listings | 13.2 | 8K | |
| 64 | $2,0898 listings | 46.6 | 32K | |
| 64 | $2,75112 listings | 36.9 | 32K | |
| 48 | $3,2715 listings | 19.7 | 8K | |
| 32 | $3,84416 listings | 28.4 | 8K | |
| 48 | $3,9553 listings | 31.9 | 8K | |
| 40 | $4,6024 listings | 48.5 | 8K | |
| Mac Studio M4 Max 128GB | 128 | $4,78813 listings | 13.8 | 32K |
| 128 | $4,83231 listings | 8.8 | 32K | |
| 32 | $4,89213 listings | 55.6 | 8K | |
| MacBook Pro M4 Max 128GB | 128 | $5,2644 listings | 13.8 | 32K |
| Mac Studio M5 Max 128GB | 128 | $5,8816 listings | 15.5 | 32K |
| 32 | $6,51313 listings | 55.6 | 8K | |
| 48 | $6,95915 listings | 42.1 | 8K | |
| MacBook Pro M5 Max 128GB | 128 | $8,1487 listings | 15.5 | 32K |
| 72 | $9,66517 listings | 42.1 | 32K | |
| 84 | $10,11117 listings | 48.9 | 32K | |
| 96 | $18,4226 listings | 55.6 | 32K | |
| Mac Studio M3 Ultra 512GB | 512 | $19,3156 listings | 20.5 | 128K |
| 32 | —No listings | 12.6 | 8K | |
| 32 | —No listings | 23.4 | 8K | |
| 32 | —No listings | 27.8 | 8K | |
| 128 | —No listings | 5.9 | 32K |
Fits when weights + KV cache + runtime overhead is at or below usable memory, single card. "Offload" on MoE models means it runs with expert weights in system RAM (only attention layers and KV cache stay in VRAM); that speed assumes 70 GB/s RAM bandwidth. The context column is the largest tier that fits.
Deploy Gemma 4 31B locally with Ollama, llama.cpp or vLLM
The Ollama library has no official tag for it yet.
llama.cpp pulls the GGUF straight from Hugging Face; -c sets the context length.
llama-server -hf unsloth/gemma-4-31B-it-GGUF:Q4_K_M -c 8192
vLLM serves the original-precision weights, which needs far more memory than GGUF and usually more than one GPU.
vllm serve google/gemma-4-31B-it
File names follow that week's model-library snapshot; the definitions are in the methodology. Methodology
FAQ
How much VRAM does Gemma 4 31B need?
At Q4_K_M with an 8K context Gemma 4 31B needs about 26GB of VRAM; 32GB leaves comfortable headroom.
What is the cheapest GPU that runs Gemma 4 31B?
The Instinct MI50 32GB: 32GB of VRAM, currently about $405, at roughly 23.3 tokens/s.
Can you run Gemma 4 31B with Ollama?
Not yet: the Ollama library has no official tag for it. You can load the GGUF with llama.cpp instead.