Google · VRAM requirements
Gemma 4 12B VRAM requirements: can you run it locally?
- Parameters12.0B
- Context256K
- 4-bit file7.1 GB
- Checked2026-11-03
Quick answer
At the popular 4-bit Q4_K_M quantization, Gemma 4 12B's weights are 7.1 GB, and an 8K-token context adds about 0.64 GB of KV cache, so plan for roughly 7.8 GB plus your engine's overhead.[3][2] The smallest GPU in our list that holds that comfortably is a 12 GB card (RTX 3060), and the smallest Mac is 16 GB. The 8-bit Q8_0 file is 12.7 GB and the 16-bit weights are 23.8 GB.[3]
Gemma 4 12B is the dense mid-size model in Google's Gemma 4 family, with vision input (no audio). Hugging Face lists 11,959,730,224 parameters for the instruction-tuned repo (google/gemma-4-12B-it), created on 2026-05-23, license Apache 2.0.[1] The model card gives a 256K-token context window for the medium models, and config.json sets 262,144 positions.[2] Hugging Face counts about 1,757,887 downloads in the last 30 days (checked November 3, 2026).[1]
Memory needed at each quantization
Quantization stores each weight in fewer bits. Smaller files fit on smaller GPUs, at some cost in quality, and the cost grows below about 4 bits. Below is every GGUF build we could source, using the exact file sizes on Hugging Face (1 GB = 1,000,000,000 bytes; split files added together), largest first.[3] Google has no official GGUF in this size, so sizes come from Unsloth's unsloth/gemma-4-12b-it-GGUF (main-folder files only; the separate MTP draft file and the vision projector are not counted).
| Quantization | Weights | |
|---|---|---|
BF16 (original) | 23.8 GB | |
UD-Q8_K_XL | 13.6 GB | |
Q8_0 | 12.7 GB | |
UD-Q6_K_XL | 10.7 GB | |
Q6_K | 9.8 GB | |
UD-Q5_K_XL | 8.6 GB | |
Q5_K_M | 8.4 GB | |
Q5_K_S | 8.2 GB | |
Q4_1 | 7.4 GB | |
UD-Q4_K_XL | 7.4 GB | |
Q4_K_M | 7.1 GB | |
Q4_K_S | 6.8 GB | |
Q4_0 | 6.7 GB | |
IQ4_NL | 6.7 GB | |
IQ4_XS | 6.4 GB | |
UD-Q3_K_XL | 6.0 GB | |
Q3_K_M | 5.7 GB | |
Q3_K_S | 5.1 GB | |
UD-Q2_K_XL | 4.7 GB | |
UD-IQ3_XXS | 4.6 GB | |
UD-IQ2_M | 4.2 GB |
Which quant should you pick? Q4_K_M is the usual balance of size and quality. Use Q5_K_M or Q6_K if you have the memory, and Q8_0 if you want results close to the original. Treat 2-bit and 3-bit builds as a last resort.
Context length adds memory (the KV cache)
On top of the weights, the engine keeps a key/value cache for every token. From config.json: 48 layers, of which 8 are global (full) attention layers with 1 KV head of size 512, and 40 are sliding-window layers with 8 KV heads of size 256 and a 1,024-token window.[2] At FP16 the global layers take 8 × 1 × 512 × 2 (K and V) × 2 bytes = 16,384 bytes per token, and the sliding layers stop growing at their window: 40 × 1,536 × 8 × 256 × 2 × 2 bytes = about 0.50 GB, fixed. llama.cpp (checked at commit 20a51f24, November 3, 2026) stores a separate V cache for Gemma 4 even when attention_k_eq_v is set: V starts from the same projection as K but is normalized differently and not rotated, so both are cached.[14][15] Its sliding-window cache holds the window plus one batch of 512 tokens (the default n_ubatch), rounded up to a multiple of 256, so we count that size, not just the window.[15]
| Context | KV cache (FP16, incl. fixed sliding-window part) |
|---|---|
| 4,096 tokens | 0.57 GB |
| 8,192 tokens | 0.64 GB |
| 32,768 tokens | 1.04 GB |
| 262,144 tokens (max) | 4.80 GB |
Some engines can store the cache in 8-bit to roughly halve it.
Which GPUs and Macs it fits on
Pick your GPU or Mac and a context length to see which quantizations fit. The weights plus the KV cache are compared with the device's memory.[4][5][6][7][8][9][10][11]
Full table: every device × quantization at 8,192 tokens
| Device | BF16 (original)24.5 GB | UD-Q8_K_XL14.3 GB | Q8_013.3 GB | UD-Q6_K_XL11.3 GB | Q6_K10.4 GB | UD-Q5_K_XL9.2 GB | Q5_K_M9.1 GB | UD-Q4_K_XL8.0 GB | Q4_K_M7.8 GB | IQ4_XS7.0 GB | UD-Q3_K_XL6.7 GB | Q3_K_M6.3 GB | UD-Q2_K_XL5.3 GB | UD-IQ2_M4.9 GB |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RTX 40608 GB | No | No | No | No | No | No | No | No | Tight | Fits | Fits | Fits | Fits | Fits |
| RTX 306012 GB | No | No | No | Tight | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| RTX 4060 Ti16 GB | No | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| RTX 309024 GB | No | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| RTX 409024 GB | No | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| RTX 509032 GB | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| RTX 6000 Ada48 GB | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| A10080 GB | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| Mac16 GB unified | No | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| Mac24 GB unified | No | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| Mac32 GB unified | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
| Mac64 GB unified | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits | Fits |
Column headers show weights + 8,192-token KV cache.
How to read it: "Fits" means weights + cache use under 90% of memory. "Tight" means 90–100%: it may load, but the engine's own working memory or a longer context can push it over. "No" means it won't fit on the GPU alone. The 90% line is our own rule of thumb, not a vendor figure. On a Mac, macOS also needs some of the unified memory, so treat Mac rows as optimistic.
Our recommendations
These follow from the file sizes and the 90% rule, at an 8K context.[3]
| Your GPU memory | Best quant that fits comfortably | Total |
|---|---|---|
| 8 GB | IQ4_XS (6.4 GB) | 7.0 GB with an 8K context |
| 12 GB | Q6_K (9.8 GB) | 10.4 GB with an 8K context |
| 16 GB | UD-Q8_K_XL (13.6 GB) | 14.3 GB with an 8K context |
| 32 GB | BF16 (original) (23.8 GB) | 24.5 GB with an 8K context |
How to run it
With llama.cpp, LM Studio or Ollama, download a GGUF file from the quant list above (for example the Q4_K_M build) from unsloth/gemma-4-12b-it-GGUF.[3] If the model is bigger than your VRAM, these tools can keep some layers in system RAM, but every token then waits on the slower memory, so expect much lower speed.
Cheapest GPU to rent for Gemma 4 12B
On-demand prices listed on Runpod's pricing page for cards that hold Q4_K_M with an 8K context (checked November 2, 2026; Community Cloud is cheaper but runs on shared hosts):[12]
| GPU (Runpod (on-demand, as listed)) | VRAM | Price |
|---|---|---|
| RTX A5000 (Community) | 24 GB | $0.16/hr |
| RTX 3090 (Community) | 24 GB | $0.22/hr |
| RTX A5000 | 24 GB | $0.27/hr |
| RTX A6000 (Community) | 48 GB | $0.33/hr |
| RTX 4090 (Community) | 24 GB | $0.34/hr |
| A40 (Community) | 48 GB | $0.35/hr |
Prices checked on 2026-11-03. They change often, so confirm on the provider's page. Each of these holds Q4_K_M plus an 8K context (7.8 GB) under our 90% rule. Rent on Runpod Referral link
Rent a GPU: Vast.ai Affiliate partner · Runpod Referral link · E2E Networks. Run it via API instead: Novita AI model APIs Affiliate partner, or compare AI APIs.
We may earn from links marked Affiliate partner or Referral link. Disclosure. Buying instead? Read our best GPUs with 12 GB guide.
See all GPU rental prices for Lambda, Vast.ai and multi-GPU setups, or compare it with other models in the VRAM table.[13]
Frequently asked questions
How much VRAM does Gemma 4 12B need at 4-bit?
About 7.8 GB for the Q4_K_M weights (7.1 GB) plus an 8K-token FP16 KV cache (0.64 GB), before engine overhead.[3][2]
What is the smallest GPU that runs Gemma 4 12B?
In our list, a 12 GB card (RTX 3060) holds Q4_K_M with an 8K context under our 90% rule. Smaller cards need a lower-bit quant from the table above.[3]
How much does the full 256K context add?
At FP16 the KV cache for 262,144 tokens is about 4.80 GB (32K tokens: 1.04 GB).[2]
How we calculated
- Weights are the exact GGUF file sizes on Hugging Face, checked November 3, 2026.[3]
- KV cache is calculated from
config.json. We assume an FP16 cache.[2] - Device memory is from NVIDIA and Apple spec pages. We compare in decimal GB, so the results lean conservative.
- Rental prices are the listed on-demand Runpod rates, checked November 2, 2026.[12]
- Not included: engine working buffers, the vision/audio projector, the OS and display. These vary by engine and settings, so leave headroom.
Sources
All sources checked on .
- Hugging Face, google/gemma-4-12B-it (parameter count, license, repo date, 30-day downloads; checked November 3, 2026). https://huggingface.co/google/gemma-4-12B-it
- Hugging Face, google/gemma-4-12B-it config.json (layers, KV heads, head size, context). https://huggingface.co/google/gemma-4-12B-it/blob/main/config.json
- Hugging Face, unsloth/gemma-4-12b-it-GGUF file list (exact GGUF sizes; checked November 3, 2026). https://huggingface.co/unsloth/gemma-4-12b-it-GGUF/tree/main
- NVIDIA, GeForce RTX 4060 family (8 GB / 16 GB) https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4060-4060ti/
- NVIDIA, GeForce RTX 3060 family (12 GB) https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3060-3060ti/
- NVIDIA, GeForce RTX 3090 specs (24 GB) https://www.nvidia.com/en-us/geforce/graphics-cards/30-series/rtx-3090-3090ti/
- NVIDIA, GeForce RTX 4090 specs (24 GB) https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4090/
- NVIDIA, GeForce RTX 5090 specs (32 GB) https://www.nvidia.com/en-us/geforce/graphics-cards/50-series/rtx-5090/
- NVIDIA, RTX 6000 Ada Generation (48 GB) https://www.nvidia.com/en-us/products/workstations/rtx-6000/
- NVIDIA, A100 (80 GB) https://www.nvidia.com/en-us/data-center/a100/
- Apple, MacBook Pro tech specs (unified memory options) https://www.apple.com/macbook-pro/specs/
- Runpod, GPU pricing (checked November 2, 2026). https://www.runpod.io/pricing
- VRAMNeeded comparison table (sources listed per model). https://vramneeded.com/compare/
- GitHub, ggml-org/llama.cpp src/models/gemma4.cpp (Gemma 4 K/V handling; commit 20a51f24, checked November 3, 2026). https://github.com/ggml-org/llama.cpp/blob/20a51f24a8523b290dcc1fc4fe9ce8fbdef9de13/src/models/gemma4.cpp
- GitHub, ggml-org/llama.cpp src/llama-kv-cache-iswa.cpp (sliding-window cache size; same commit). https://github.com/ggml-org/llama.cpp/blob/20a51f24a8523b290dcc1fc4fe9ce8fbdef9de13/src/llama-kv-cache-iswa.cpp