Google · released 2026-03-11
Gemma 4 31B
Largest dense Gemma 4 model, with image input, configurable thinking and a 256K context; Apache 2.0 licensed.
- Parameters
- 31B
- Active / token
- 31B
- Context
- 256K
- Memory at Q4
- 20.8 GB
- License
- apache-2.0
- Images
- Yes
- Thinking mode
- Yes
Cheapest ways to use it $0.09 in / $0.34 out per 1M tokens via DeepInfra (12 providers) · or free on RTX 3090 or better
Get started
1 · Try it now
Chat with it on Google AI Studio ↗ Use via API from $0.09/1M on DeepInfraFree online chats are the quickest way to see if a model suits you before downloading anything.
2 · Download the files
- Official weights google/gemma-4-31B-it
- GGUF for Ollama, LM Studio, llama.cpp ggml-org/gemma-4-31B-it-GGUF
- MLX for Macs (4-bit) mlx-community/gemma-4-31b-it-4bit
- Licence apache-2.0
You’ll need about 20.8 GB of memory at 4-bit. Check your machine →
3 · Run it on your machine
Install LM Studio, then click “Open in LM Studio” — or search for this in its Discover tab:
ggml-org/gemma-4-31B-it-GGUFDownloads the file and starts a local chat server at http://localhost:8080:
llama-server -hf ggml-org/gemma-4-31B-it-GGUF:Q4_0Fastest on Apple Silicon. Needs Python:
pip install mlx-lmmlx_lm.chat --model mlx-community/gemma-4-31b-it-4bitFor a Linux GPU server, serving an OpenAI-compatible API:
vllm serve google/gemma-4-31B-itWill it run on my computer?
Gemma 4 31B needs roughly 20.8 GB of GPU memory at the usual Q4 quality. Check your exact machine →
| Machine | Best file | Fit | Est. speed |
|---|---|---|---|
| RTX 4060 | Q4_K_M | Spills to RAM | ~3.2 tok/s · Slow |
| RTX 3060 12GB | Q4_K_M | Spills to RAM | ~4.3 tok/s · Slow |
| RTX 4060 Ti 16GB | Q4_K_M | Spills to RAM | ~5.6 tok/s · Slow |
| RTX 3090 | Q4_K_M | Fits in memory | ~33 tok/s · Fast |
| RTX 4090 | Q4_K_M | Fits in memory | ~35 tok/s · Fast |
| RTX 5090 | Q5_K_M | Fits in memory | ~50 tok/s · Fast |
| M4 · 16 GB | — | Too big | — |
| M4 Pro · 48 GB | Q3_K_M | Fits in memory | ~11 tok/s · Usable |
| M4 Max · 128 GB | Q5_K_M | Fits in memory | ~15 tok/s · Usable |
| M3 Ultra · 512 GB | Q5_K_M | Fits in memory | ~22 tok/s · Usable |
| DGX Spark | Q4_K_M | Fits in memory | ~10 tok/s · Usable |
| Ryzen AI Max+ 395 | Q4_K_M | Fits in memory | ~7.8 tok/s · Slow |
PCs assume 64 GB system RAM. Estimates, not measurements — method.
Ways to run it
Use it through an API 12 providers
Heads up: providers serve this model at different compression levels (fp4, fp8). 4-bit versions are cheaper to run and can be slightly worse.
| Provider | Input / 1M | Output / 1M | Stated precision | Context | |
|---|---|---|---|---|---|
| DeepInfra | $0.09 $0.05 cached | $0.34 | fp4 | 256K | source ↗ |
| Featherless | $0.12 | $0.36 | not stated | 256K | source ↗ |
| Venice | $0.12 $0.05 cached | $0.36 | fp4 | 250K | source ↗ |
| Chutes | $0.12 $0.012 cached | $0.37 | fp4 | 128K | source ↗ |
| Amazon Bedrock | $0.14 | $0.40 | not stated | — | source ↗ |
| Crusoe Cloud | $0.14 $0.14 cached | $0.40 | not stated | — | source ↗ |
| FriendliAI | $0.14 | $0.40 | not stated | — | source ↗ |
| Parasail | $0.15 $0.06 cached | $0.40 | not stated | — | source ↗ |
| DeepInfra | $0.20 | $0.40 | fp8 | 256K | source ↗ |
| DeepInfra | $0.27 | $0.76 | fp8 | 128K | source ↗ |
| SambaNova (SambaCloud) | $0.38 | $1.15 | not stated | 128K | source ↗ |
| SiliconFlow | $0.75 $0.25 cached | $1.00 | not stated | 256K | source ↗ |
Prices in USD from each provider’s own pricing page, checked 2026-12-04. Cheapest highlighted.
Rent a GPU and run it yourself
| Setup | From | Per hour | File | Est. speed | Per 1M tokens* |
|---|---|---|---|---|---|
| 1× RTX A5000 24GB | RunPod community | $0.16 | 4-bit 20.8 GB | ~27 tok/s | $1.62 |
| 1× RTX 3090 24GB | Vast.ai marketplace | $0.21 | 4-bit 20.8 GB | ~33 tok/s | $1.78 |
| 1× RTX 3090 Ti 24GB | Vast.ai marketplace | $0.27 | 4-bit 20.8 GB | ~35 tok/s | $2.14 |
| 1× L4 24GB | Vast.ai marketplace | $0.32 | 4-bit 20.8 GB | ~11 tok/s | $7.90 |
*For one conversation at a time. Serving many users at once (batching, e.g. with vLLM) cuts the cost per token by 10× or more, which is how API providers get so cheap. Rental prices checked 2026-12-04. All GPU prices →
On your own machine
Free after the hardware. See the table above for which GPUs and Macs can run it, or check your exact machine. Easiest apps: Ollama and LM Studio.
Memory by quality level
| File | Quality | Weights | + 8K context | Total |
|---|---|---|---|---|
| Q3_K_M | Noticeably worse | 15.3 GB | 0.7 GB | 17.0 GB |
| Q4_K_M | Good — the usual pick | 19.0 GB | 0.7 GB | 20.8 GB |
| Q5_K_M | Very close to full | 22.3 GB | 0.7 GB | 24.2 GB |
| Q6_K | Near lossless | 25.8 GB | 0.7 GB | 27.9 GB |
| Q8_0 | Practically lossless | 33.3 GB | 0.7 GB | 35.5 GB |
| FP16 | Full precision | 62.6 GB | 0.7 GB | 65.7 GB |
Test answers
Gemma 4 31B is queued for our test suite. See tested models →