Gemma 4 31B has 31.3B parameters. In BF16 its weights alone take 58.2 GiB; quantized to 4-bit, about 17.5 GiB. Each 32K-token request adds 3.28 GiB of KV cache. Cheapest way to run it today: 1 × GeForce RTX 3090 (24 GB) at $0.121 per hour. It reads text, images, video and audio, calls tools and has a thinking mode you can switch off.
Read every day from Hugging Face. Split files are added together; vision projectors are left out.
How many GPUs to run Gemma 4 31B
Fewest GPUs that fit the weights plus one 8K-token request. Data-center GPUs use vLLM (90% of memory usable), the others llama.cpp. Several GPUs split the model with tensor or pipeline parallelism.
GPU
BF16 / FP16
8-bit
4-bit
GeForce RTX 4090 24 GB
3
2
1
GeForce RTX 5090 32 GB
3
2
1
RTX PRO 6000 Blackwell 96 GB
1
1
1
Mac M5 Max 128 GB 107.5 GB usable
1
1
1
Ryzen AI Max+ 395 128 GB 96 GB usable
1
1
1
DGX Spark (GB10) 128 GB
1
1
1
NVIDIA H100 80 GB
1
1
1
NVIDIA H200 141 GB
1
1
1
NVIDIA B200 (HGX) 180 GB
1
1
1
8-bit: FP8 with vLLM (INT8 on GPUs without FP8), Q8_0 with llama.cpp. 4-bit: AWQ / GPTQ with vLLM, Q4_K_M with llama.cpp, both counted at the Q4_K_M size.
Cheapest way to run Gemma 4 31B today
For each GPU: the fewest cards that fit Gemma 4 31B with one 8K-token request, the most faithful weight format at that count, and the cheapest on-demand price (2026-11-24).
On-demand prices from AWS, Google Cloud, Azure, RunPod, Vast.ai, Oracle Cloud, OVHcloud, Scaleway, Verda, Akash and UpCloud, checked every hour. Serving many users needs more KV cache, so more memory: size it in the calculator. Some links are affiliate links: StudioTV may earn a commission, at no extra cost to you.
vLLM and SGLang apply these defaults unless a request sets its own. With llama.cpp, pass them yourself: --temp 1 --top-p 0.95 --top-k 64
Reasoning. Thinking mode you can switch on or off. With vLLM or SGLang, set it per request: "chat_template_kwargs": {"enable_thinking": false} turns it off, true on. Reasoning tokens take context and KV cache like any other token: leave room for them.
KV cache: how memory grows with context
Architecture: 50 sliding-window layers (1024 tokens, 16 KV × 256) · 10 global layers (4 KV × 512). Its KV cache is 9.1× smaller than if every layer used full attention, because most layers only keep a short window of recent tokens.
Context per request
BF16 cache
FP8 cache
8K tokens
1.41 GiB
0.70 GiB
32K tokens
3.28 GiB
1.64 GiB
128K tokens
10.8 GiB
5.39 GiB
256K tokens
20.8 GiB
10.4 GiB
Gemma 4 31B VRAM FAQ
How much VRAM does Gemma 4 31B need?
In BF16 the weights alone take 58.2 GiB (63 GB). In FP8 that is 30.4 GiB, and about 17.5 GiB with 4-bit quantization (Q4_K_M). Each request then adds KV cache: 1.41 GiB at 8K tokens and 3.28 GiB at 32K (BF16 cache).
Can Gemma 4 31B run on a single RTX 4090 (24 GB)?
Yes. In Q4_K_M it fits on one RTX 4090 with an 8K-token context (18.9 GiB including the cache, with llama.cpp).
Can Gemma 4 31B run on an RTX 5090 (32 GB)?
Yes. In Q4_K_M (18.9 GiB with an 8K-token context) it fits on one RTX 5090, with llama.cpp.
Can Gemma 4 31B run on a Mac?
Yes. In 4-bit (Q4_K_M with llama.cpp) it needs a Mac with 32 GB of unified memory or more, of which macOS gives the GPU about 25 GB, for one request with an 8K-token context. In 8-bit (Q8_0) it needs 48 GB or more.
Can Gemma 4 31B run on a DGX Spark or a Ryzen AI Max+ 395 (128 GB)?
Yes. In BF16 (59.7 GiB with an 8K-token context) it fits on a DGX Spark (128 GB) and on a Ryzen AI Max+ 395 with 128 GB, whose GPU gets up to 96 GB, with llama.cpp and one request.
What is the cheapest way to run Gemma 4 31B?
On 2026-11-24, the cheapest on-demand setup is 1 × GeForce RTX 3090 (24 GB) with Q4_K_M weights on Vast.ai, at $0.121 per hour (about $88.33 per month). Next: 1 × RTX A5000 (24 GB) with Q4_K_M weights on Vast.ai, at $0.161 per hour. Sized for one 8K-token request; prices are checked every hour.
How many H100 GPUs does Gemma 4 31B need?
With one request and an 8K-token context: 1 in BF16, 1 in FP8 and 1 in 4-bit (vLLM, 90% of memory usable). Serving many users at once needs more memory for their KV caches: the calculator sizes that for you.
Can Gemma 4 31B read images?
Yes. Gemma 4 31B reads text, images, video and audio. Images add tokens to the context, so they also add KV cache.
Does Gemma 4 31B support tool calling?
Yes, Gemma 4 31B supports tool (function) calling: it can ask your application to run a function and use the result.
Does Gemma 4 31B have a thinking mode?
Thinking mode you can switch on or off. With vLLM or SGLang, set it per request with "chat_template_kwargs": {"enable_thinking": false} (or true). Reasoning tokens count toward the context and the KV cache.
What temperature should I use with Gemma 4 31B?
The official defaults are temperature 1, top-p 0.95, top-k 64.
Gemma 4 31B VRAM badge
For a model card or a README: the 4-bit size and the smallest GPU it fits on, linked to this page. Data as JSON: /api/models/gemma-4-31b.json.
Estimates, not guarantees: computed from the official config.json with the same engine as the LLM VRAM Calculator. Real usage depends on your engine version and settings.