Gemma 4 12B VRAM requirements

Gemma 4 12B needs about 8.57 GB of VRAM at Q4_K_M with 8K context, so it fits a 12 GB card such as the RTX 3060 12GB or the RTX 4070 12GB. Gemma 4 12B has 12.0B parameters. With the same 8K context and one request it needs 13.4 GB at FP8 and 25.7 GB at FP16/BF16. The published weights take 22.3 GB (BF16). The smallest setup here that holds it at Q4_K_M with an 8K context is the RTX 3060 12GB; on one 24 GB RTX 3090 / 4090 it runs with its full 256K-token context.

8.57 GB at Q4_K_M, 8K context, one request

FP8
13.4 GB
FP16 / BF16
25.7 GB
Published weights
22.3 GB
Smallest setup, Q4_K_M
RTX 3060 12GB
Open Gemma 4 12B in the calculator

Worked example: Gemma 4 12B with 32K tokens

Inputs: Gemma 4 12B · Q4_K_M weights · 32,768 tokens of context · one request · FP16 KV cache

Weights (12.0B at Q4_K_M)
6.74 GB
KV cache (16 KB per token)
992 MB
Buffers and runtime (0.5 GB + 10%)
1.27 GB
Total
8.98 GB

The smallest setup here that holds it is the RTX 3060 12GB, with about 3.02 GB to spare. Change the inputs in the calculator

Can I run Gemma 4 12B on…

What makes Gemma 4 12B's memory use different

Its 40 sliding-window layers keep only the last 1,024 tokens (llama.cpp gives them 1,536 cells: the window plus a 512-token batch, rounded up to 256): at its 256K limit they hold 480 MB of cache instead of the 80.0 GB they would need with full attention.

Per token of context it adds 16 KB of FP16 cache; Granite 4.2 8B (8.8B), the nearest-sized model here with plain full attention, adds 160 KB, so Gemma 4 12B needs 10% as much.

How much VRAM does Gemma 4 12B need?

Gemma 4 12B needs 8.57 GB at Q4_K_M, 14.2 GB at Q8_0 and 25.7 GB at FP16 with 8,192 tokens of context and one request. Each total below is the weights plus the FP16 KV cache and the runtime overhead (0.5 GB plus 10%), and each row opens the calculator with that setting. What the GGUF names mean.

PrecisionWeightsTotalSmallest setup
As published (BF16) 22.3 GB 25.7 GB RTX 5090 (32 GB)
FP16 / BF16 22.3 GB 25.7 GB RTX 5090 (32 GB)
FP8 / INT8 11.1 GB 13.4 GB RTX 4060 Ti 16GB
INT4 (AWQ / GPTQ) 5.92 GB 7.66 GB RTX 4060 8GB
GGUF Q8_0 11.8 GB 14.2 GB RTX 4060 Ti 16GB
GGUF Q6_K 9.13 GB 11.2 GB RTX 3060 12GB
GGUF Q5_K_M 7.89 GB 9.84 GB RTX 3060 12GB
GGUF Q4_K_M 6.74 GB 8.57 GB RTX 3060 12GB
GGUF IQ4_XS 6.06 GB 7.82 GB RTX 4060 8GB
GGUF Q3_K_M 5.44 GB 7.14 GB RTX 4060 8GB
GGUF IQ3_XXS 4.59 GB 6.21 GB RTX 4060 8GB
GGUF Q2_K 4.66 GB 6.28 GB RTX 4060 8GB

Fine-tuning Gemma 4 12B? Gemma 4 12B VRAM for LoRA, QLoRA and full training.

Gemma 4 12B GGUF files on Hugging Face

The 8 GGUF files llama.cpp picks for Gemma 4 12B with -hf <repo>:<QUANT>, with the bytes the Hugging Face file list reported on 2026-09-29. Each total is that file plus the FP16 KV cache and 0.5 GB + 10%, one request. "vs estimate" compares the file with the bits-per-weight size the table above uses.

QuantFileSizevs estimate 8K32K128K
Q2_K bartowski/gemma-4-12B-it-GGUF 4.73 GB5,077,875,168 bytes +1% 6.36 GB6.77 GB8.42 GB
Q3_K_M unsloth/gemma-4-12b-it-GGUF 5.30 GB5,693,872,960 bytes −3% 6.99 GB7.40 GB9.05 GB
IQ4_XS unsloth/gemma-4-12b-it-GGUF 5.94 GB6,375,734,080 bytes −2% 7.68 GB8.10 GB9.75 GB
Q4_K_M unsloth/gemma-4-12b-it-GGUF 6.63 GB7,121,861,440 bytes −2% 8.45 GB8.86 GB10.5 GB
Q5_K_M unsloth/gemma-4-12b-it-GGUF 7.84 GB8,413,576,000 bytes −1% 9.77 GB10.2 GB11.8 GB
Q6_K unsloth/gemma-4-12b-it-GGUF 9.11 GB9,786,022,720 bytes ±0% 11.2 GB11.6 GB13.2 GB
Q8_0 ggml-org/gemma-4-12B-it-GGUF 11.8 GB12,669,646,976 bytes ±0% 14.1 GB14.5 GB16.2 GB
BF16 ggml-org/gemma-4-12B-it-GGUF 22.2 GB23,832,066,176 bytes ±0% 25.6 GB26.0 GB27.6 GB

GB here is GiB (1024³ bytes), as everywhere on this site; Hugging Face shows the Q4_K_M file as 7.1 GB, in 10⁹ bytes.

Gemma 4 12B Heretic (decensored) variants

Heretic removes refusals from a model automatically: it ablates the "refusal direction" in the weights and tunes the ablation to keep the output close to the original. igorls/gemma-4-12B-it-heretic-v1 reports 0 of 100 refusals on harmful prompts (Gemma 4 12B: 99 of 100) at a KL divergence of 0.0284 from the original on harmless prompts. Gemma's license and usage policy still apply.

It is the same model with edited weights, not a new architecture: its safetensors take 23,919,548,424 bytes against 23,919,549,408 for google/gemma-4-12B-it, so every KV cache, context and GPU figure on this page applies to it. Only the GGUF files differ. The most downloaded ones, with the totals this page's method gives:

QuantFileSize 8K32K128K
Q4_K_M igorls/gemma-4-12B-it-heretic-GGUF 6.87 GB7,381,381,760 bytes 8.72 GB9.13 GB10.8 GB
Q8_0 igorls/gemma-4-12B-it-heretic-GGUF 11.8 GB12,669,645,440 bytes 14.1 GB14.5 GB16.2 GB
IQ3_XS culturerevolt/gemma-4-12b-heretic-abliterated-GGUF 4.91 GB5,272,393,056 bytes 6.55 GB6.97 GB8.62 GB
IQ4_XS culturerevolt/gemma-4-12b-heretic-abliterated-GGUF 6.18 GB6,635,255,136 bytes 7.95 GB8.36 GB10.0 GB
Q4_K_M culturerevolt/gemma-4-12b-heretic-abliterated-GGUF 6.87 GB7,381,382,496 bytes 8.72 GB9.13 GB10.8 GB
Q5_K_M culturerevolt/gemma-4-12b-heretic-abliterated-GGUF 7.96 GB8,547,267,936 bytes 9.91 GB10.3 GB12.0 GB
Q6_K culturerevolt/gemma-4-12b-heretic-abliterated-GGUF 9.11 GB9,786,021,216 bytes 11.2 GB11.6 GB13.2 GB
Q8_0 culturerevolt/gemma-4-12b-heretic-abliterated-GGUF 11.8 GB12,669,645,440 bytes 14.1 GB14.5 GB16.2 GB
UD-Q4_K_XL (QAT) SC117/gemma-4-12B-it-heretic-QAT-GGUF 6.26 GB6,716,355,776 bytes 8.03 GB8.45 GB10.1 GB

The Heretic Q4_K_M files are 259,520,320 bytes (0.24 GB) larger than the unsloth Q4_K_M above; the Q8_0 files are within 2 KB of ggml-org's. For images, both culturerevolt and SC117 ship the 175,115,840-byte (0.16 GB) vision projector (mmproj) as a separate file, which adds that much to the totals. File sizes from the Hugging Face file lists, read on ; totals as in the table above, one request, FP16 KV cache.

Which Gemma 4 12B GGUF fits a 16, 24, 32, 48 or 80 GB GPU or a Mac

From the file sizes above: the largest file that fits each machine with an 8K context and 0.5 GB left free, the longest context it then has room for, and the longest context for Q4_K_M (6.63 GB). One request, FP16 KV cache, -np 1. The Q4_K_M file is 109 MB under its bits-per-weight estimate; the estimate tables and the llama-server command on this page count the estimate, so they show less context.

HardwareLargest GGUF, 8KIts longest contextQ4_K_M, longest context
RTX 5060 Ti 16GB Q8_0, 11.8 GB 87K 256K (full)
RTX 4090 (24 GB) Q8_0, 11.8 GB 256K (full) 256K (full)
RTX 5090 (32 GB) BF16, 22.2 GB 256K (full) 256K (full)
L40S (48 GB) BF16, 22.2 GB 256K (full) 256K (full)
H100 SXM (80 GB) BF16, 22.2 GB 256K (full) 256K (full)
M4 Pro Mac (64 GB, 48 GB usable) BF16, 22.2 GB 256K (full) 256K (full)
M4 Max Mac (128 GB, 96 GB usable) BF16, 22.2 GB 256K (full) 256K (full)

Run Gemma 4 12B with llama.cpp or Ollama

llama-server -hf unsloth/gemma-4-12b-it-GGUF:Q4_K_M -c 262144 -np 1

gemma-4-12b-it-Q4_K_M.gguf, 7.1 GB, from unsloth/gemma-4-12b-it-GGUF (checked 2026-09-29). On a 24 GB RTX 3090 / 4090, Q4_K_M with -c 262144 takes 12.8 GB and leaves 11.2 GB. -np 1: one slot, so one 1,024-token window.

ollama run gemma4:12b

Ollama library tag gemma4:12b; its quant is Ollama's choice. Same context: /set parameter num_ctx 262144.

Gemma 4 12B at 8K, 32K, 128K and 256K (full) tokens of context

8 of its 48 layers use full attention and 40 keep a sliding window of 1,024 tokens. Each extra token of context adds 16 KB of FP16 cache per request once the sliding windows are full. The last column is the smallest setup here, one card or a group, that holds it at Q4_K_M. How the KV cache works.

ContextKV cache, FP16Total at Q4_K_MTotal at Q8_0Smallest setup, Q4_K_M
8K tokens 608 MB 8.57 GB 14.2 GB RTX 3060 12GB
32K tokens 992 MB 8.98 GB 14.6 GB RTX 3060 12GB
128K tokens 2.47 GB 10.6 GB 16.2 GB RTX 3060 12GB
256K tokens 4.47 GB 12.8 GB 18.4 GB RTX 4060 Ti 16GB

How fast Gemma 4 12B writes

Tokens per second for one request with 8,192 tokens of context, estimated from memory bandwidth. A dash means it does not fit on one card. Try other settings in the speed calculator.

HardwareBandwidthQ4_K_MFP8
RTX 3060 12GB 360 GB/s 24–34—
RTX 4090 1,008 GB/s 64–9241–58
RTX 5090 1,792 GB/s 105–15770–101
M4 Max Mac (128 GB) 546 GB/s 36–5123–32
M3 Ultra Mac Studio (512 GB) 819 GB/s 53–7534–48
H100 SXM 3,350 GB/s 173–275120–181
H200 4,800 GB/s 223–372159–250

Longest context on one GPU

How many tokens of context Gemma 4 12B fits on a single card with one request, an FP16 KV cache and 0.5 GB left free. "Full" means the model's whole context window fits.

GPUMemoryQ4_K_MQ8_0FP8
RTX 3060 12 GB 178KNoNo
RTX 4060 Ti 16GB 16 GB 256K (full)85K129K
RTX 3090 / 4090 24 GB 256K (full)256K (full)256K (full)
RTX 5090 32 GB 256K (full)256K (full)256K (full)
A100 40GB 40 GB 256K (full)256K (full)256K (full)
Mac, 64 GB unified memory 48 GB 256K (full)256K (full)256K (full)
L40S / RTX 6000 Ada 48 GB 256K (full)256K (full)256K (full)
A100 / H100 80GB 80 GB 256K (full)256K (full)256K (full)
Mac, 128 GB unified memory 96 GB 256K (full)256K (full)256K (full)
H200 141 GB 256K (full)256K (full)256K (full)
B200 180 GB 256K (full)256K (full)256K (full)

Model details

Parameters
12.0B (11,959,730,224)
Layers
8 of its 48 layers use full attention and 40 keep a sliding window of 1,024 tokens
Attention cache
1 KV heads × 512 (values come from the key projection but are cached separately)
Sliding-window layers
8 KV heads × 256
Context length
262,144 tokens
Published weights
22.3 GB (BF16)
On Hugging Face
google/gemma-4-12B-it
Reported benchmarks
GPQA Diamond 78.8 · MMLU-Pro 77.2 · LiveCodeBench v6 72.0. Vendor-reported: from the maker’s own model card, not rerun here; read 2026-09-30.

Why this estimate looks this way

At Q4_K_M and an 8K-token context, Gemma 4 12B uses 6.74 GB for weights, 608 MB for its FP16 KV cache and 1.23 GB for estimated runtime overhead, totaling 8.57 GB. The overhead is a 0.5 GB base plus 10% of weights and cache.

Its attention layout matters for long context: 8 of its 48 layers use full attention and 40 keep a sliding window of 1,024 tokens. The FP16 cache grows by about 16 KB per additional token per request once the sliding windows are full.

The architecture and published checkpoint size come from the model's config.json and weight files. These are estimates rather than measured peak memory; inference engines can reserve extra buffers or preallocate the full configured cache.

Gemma 4 12B next to similar-sized models

The three models here closest to it in parameter count, at Q4_K_M with 8,192 tokens of context.

ModelParametersTotalKV per tokenSmallest setup
Gemma 4 12B 12.0B 8.57 GB 16 KB RTX 3060 12GB
ZDTaichu 5.0 9B 9.8B 6.85 GB 32 KB RTX 4060 8GB
Ornith 1.5 9B 9.7B 6.76 GB 32 KB RTX 4060 8GB
Qwen3.5 9B 9.7B 6.76 GB 32 KB RTX 4060 8GB

Gemma 4 12B VRAM questions

How much VRAM do I need to run Gemma 4 12B locally?

About 8.57 GB at Q4_K_M with an 8K context and one request, by the bits-per-weight estimate, and 25.7 GB at BF16. The Q4_K_M GGUF gemma-4-12b-it-Q4_K_M.gguf in unsloth/gemma-4-12b-it-GGUF is 7,121,861,440 bytes (6.63 GB); with an 8K context it needs 8.45 GB. The smallest setup listed here that holds Q4_K_M is the RTX 3060 12GB.

Can I run Gemma 4 12B on a 24 GB GPU?

Yes. On the RTX 4090 (24 GB), the largest listed GGUF that fits with an 8K context and 0.5 GB free is Q8_0 (11.8 GB), with its full 256K-token context.

Which quantization of Gemma 4 12B fits in 16 GB of VRAM?

On the RTX 5060 Ti 16GB, the largest listed GGUF that fits with an 8K context and 0.5 GB free is Q8_0 (11.8 GB), with up to 87K tokens of context. Q4_K_M (6.63 GB) runs with its full 256K-token context.

Can I run Gemma 4 12B on a Mac?

On the M4 Pro Mac (64 GB, 48 GB usable), the largest listed GGUF that fits with an 8K context and 0.5 GB free is BF16 (22.2 GB), with its full 256K-token context. On the M4 Max Mac (128 GB, 96 GB usable), the largest listed GGUF that fits with an 8K context and 0.5 GB free is BF16 (22.2 GB), with its full 256K-token context. By default macOS lets the GPU use about 75% of unified memory.

How much more VRAM does Gemma 4 12B need for 32K or 128K tokens of context?

Its FP16 KV cache is 608 MB at 8K, 992 MB at 32K, 2.47 GB at 128K for one request, so 128K adds 1.88 GB over 8K, plus 10% overhead. A q8_0 cache (-ctk q8_0 -ctv q8_0) takes 1.31 GB at 128K. Its 40 sliding-window layers stop growing at 1,024 tokens, so only 8 layers keep adding cache.

Why does Gemma 4 12B use more VRAM than its GGUF file size?

The file holds only the weights. At Q4_K_M with an 8K context: 6.63 GB of weights (the file's 7,121,861,440 bytes) + 608 MB of FP16 KV cache + 1.22 GB of compute buffers and runtime (0.5 GB + 10%) = 8.45 GB.

Badge for your model card

Paste it into a Hugging Face or GitHub README; it shows the Q4_K_M total above and links to this page. Q8_0 and FP16 badges.

Gemma 4 12B VRAM: 8.57 GB at Q4_K_M, 8K context

Numbers read from the model files on Hugging Face on . Compare it with other models in the reproducible model and GPU report.