Can I run Gemma 4 31B on the GeForce RTX 4060?
Runs slowlyQ4_K_M does not fit fully in VRAM, so 12.2 GB of the weights run from system RAM: Runs slowly, est. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%).
8 GB VRAM · 272.0 GB/s · FP16 15.1 TFLOPS. Assumes 32 GB of DDR5-5600 system RAM, Windows with this GPU driving the display, 8k context and an f16 KV cache.
Verdict by system RAM
This page assumes 32 GB of system RAM. For this pair, the verdict depends on how much system RAM you have.
- 16 GBWon't runTry IQ4_XS: Runs slowlyest. 3.7 tok/s (3.0–4.4, calibrated estimate ±20%)
- 32 GBRuns slowlyest. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%)(used on this page)
- 64 GBRuns slowlyest. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%)
- 96 GBRuns slowlyest. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%)
- 128 GBRuns slowlyest. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%)
Every quant of Gemma 4 31B on the GeForce RTX 4060
| Quant | File size | Verdict | Speed | Memory | Runs as | Notes |
|---|---|---|---|---|---|---|
| UD-Q2_K_XL | 11.77 GB | Runs slowly | est. 6.0 tok/s4.8–7.2calibrated estimate ±20% | 8.0 / 8.0 GB + 5.6 GB RAM | Partial offload | — |
| IQ4_XS | 16.37 GB | Runs slowly | est. 3.7 tok/s3.0–4.4calibrated estimate ±20% | 8.0 / 8.0 GB + 10.2 GB RAM | Partial offload | — |
| Q4_K_Mbaseline | 18.32 GB | Runs slowly | est. 3.2 tok/s2.5–3.8calibrated estimate ±20% | 8.0 / 8.0 GB + 12.2 GB RAM | Partial offload | — |
| Q8_0 | 32.64 GB | Won't run | est. 1.6 tok/s1.3–1.9calibrated estimate ±20% | 8.0 / 8.0 GB + 26.5 GB RAM | Partial offload | Fits, but too slow to use |
Models with a thinking mode spend extra tokens thinking, so their speed thresholds are 1.5× stricter (30 / 12 / 3 tok/s). With thinking turned off, a model may do one grade better.
Where the memory goes at Q4_K_M
- Weights
- 6.2 GB
- KV cache
- 0.7 GB
- Compute buffer
- 0.6 GB
- OS reserve
- 0.6 GB
- Weights in system RAM
- 12.2 GB
System RAM, context length and KV cache
| Context | KV f16 | KV q8_0 | KV q4_0 |
|---|---|---|---|
| 4k | 19.2 GBRuns slowly est. 3.3 tok/s2.6–4.0calibrated estimate ±20% | 19.0 GBRuns slowly est. 3.4 tok/s2.7–4.0calibrated estimate ±20% | 18.9 GBRuns slowly est. 3.4 tok/s2.7–4.1calibrated estimate ±20% |
| 8k | 19.5 GBRuns slowly est. 3.2 tok/s2.5–3.8calibrated estimate ±20% | 19.2 GBRuns slowly est. 3.3 tok/s2.6–3.9calibrated estimate ±20% | 19.1 GBRuns slowly est. 3.3 tok/s2.7–4.0calibrated estimate ±20% |
| 16k | 20.3 GBWon't run est. 2.9 tok/s2.4–3.5calibrated estimate ±20% | 19.7 GBRuns slowly est. 3.1 tok/s2.5–3.8calibrated estimate ±20% | 19.3 GBRuns slowly est. 3.3 tok/s2.6–3.9calibrated estimate ±20% |
| 32k | 21.8 GBWon't run est. 2.5 tok/s2.0–3.1calibrated estimate ±20% | 20.5 GBWon't run est. 2.9 tok/s2.3–3.5calibrated estimate ±20% | 19.9 GBRuns slowly est. 3.1 tok/s2.5–3.7calibrated estimate ±20% |
| 64k | 24.8 GBWon't run est. 2.0 tok/s1.6–2.4calibrated estimate ±20% | 22.3 GBWon't run est. 2.5 tok/s2.0–3.0calibrated estimate ±20% | 20.9 GBWon't run est. 2.8 tok/s2.3–3.4calibrated estimate ±20% |
| 128k | 30.7 GBdoes not fit | 24.1 GBWon't run est. 1.9 tok/s1.5–2.2calibrated estimate ±20% | 23.1 GBWon't run est. 2.4 tok/s1.9–2.8calibrated estimate ±20% |
| 256k | 42.7 GBdoes not fit | 32.7 GBdoes not fit | 24.4 GBWon't run est. 1.8 tok/s1.5–2.2calibrated estimate ±20% |
S = Runs great · A = Runs well · B = Runs slowly · F = Won't run
At Q4_K_M the verdict stays Runs slowly up to 8k context with an f16 KV cache, and up to 16k with q8_0.
Estimated speed
- Generation
- est. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%)
- Prompt processing
- Prompt-processing estimates only apply when the whole model runs on the GPU.
Measured on this exact combination
No public measurement for this exact combination yet; the numbers above are estimates.
If this is not enough
A smaller model that runs well on the GeForce RTX 4060
Runs wellQwen3 30B-A3B (2507): Runs well, est. 32.4 tok/s (22.6–42.1, theoretical estimate ±30%)
Cheapest GPU that runs Gemma 4 31B great
Runs greatGeForce RTX 3090 — $1,050 street (as of 2026-08-09): est. 34.5 tok/s (30.4–38.6, calibrated estimate ±12%).
How to run it
Commands for the Q4_K_M file. Both tools download from Hugging Face on first run.
These commands assume 32 GB of system RAM. For a different amount of RAM, pick it under “System RAM, context length and KV cache” above to see the commands for it.
File: gemma-4-31B-it-Q4_K_M.gguf (18.32 GB) from unsloth/gemma-4-31B-it-GGUF.
llama-server -hf unsloth/gemma-4-31B-it-GGUF:Q4_K_M -c 8192 -ngl 20 -fa on- -ngl 20 puts 20 of 60 layers on the GPU; if VRAM overflows, lower it by 1–2.
- -fa on enables flash attention (needed for KV cache quantization).
- --cache-type-k q8_0 --cache-type-v q8_0 shrinks the KV cache to 0.36 GB at 8k context.
PowerShell (quit the Ollama tray app first):
$env:OLLAMA_CONTEXT_LENGTH="8192"; ollama serve
ollama run hf.co/unsloth/gemma-4-31B-it-GGUF:Q4_K_M- Ollama defaults to 4k context on GPUs under 24 GB. Set OLLAMA_CONTEXT_LENGTH when starting the server, or /set parameter num_ctx inside the chat.
- Ollama splits layers between GPU and CPU automatically.
/set parameter num_ctx 8192
Related pages
Guide: How much VRAM do local LLMs need? GPU requirements for 8–32 GB (2026)
Other models on the GeForce RTX 4060
Gemma 4 31B on other hardware
Frequently asked questions
Can I run Gemma 4 31B on the GeForce RTX 4060?
Q4_K_M does not fit fully in VRAM, so 12.2 GB of the weights run from system RAM: Runs slowly, est. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%). Q4_K_M needs 19.5 GB at 8k context; this setup has 7.4 GB of usable memory and 28.0 GB of free system RAM.
How much context can Gemma 4 31B use on the GeForce RTX 4060?
At Q4_K_M the verdict stays Runs slowly up to 8k context with an f16 KV cache (0.7 GB of KV) and up to 16k with a q8_0 KV cache (0.7 GB). The model supports up to 256k.
Which quant should I use, and how fast is it?
Q4_K_M (18.32 GB) is the recommended balance: Runs slowly, est. 3.2 tok/s (2.5–3.8, calibrated estimate ±20%). It is also the largest tracked file that gets this verdict.
Speeds are estimates from memory bandwidth, calibrated against public benchmarks, and each one comes with an error band and a confidence label. Real results vary with drivers, backend, context length and thermals.