Running Gemma 3 27B on a Single 24 GB GPU
Google Gemma 3 27B is the flagship single-GPU multimodal model in the Gemma 3 family, combining strong instruction following, 140+ language coverage, vision understanding and a 128K context window in 27.4B parameters.
Run ollama run gemma3:27b to pull the 4-bit GGUF (~17.4 GB download). At 8K context, Q4_K_M needs about 22.0 GB total memory — fitting a 24 GB RTX 3090/4090 or a 32–36 GB Apple Silicon Mac cleanly.
# Pull and launch Gemma 3 27B (~17.4 GB download, fits 24 GB RTX 4090 at 8K)
ollama run gemma3:27b
# Enable quantized KV cache in Ollama to fit 16K–32K context on 24 GB GPUs:
OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama servellama-server \
-hf ggml-org/gemma-3-27b-it-GGUF:Q4_K_M \
--ctx-size 16384 \
--flash-attn \
--cache-type-k q8_0 --cache-type-v q8_0 \
--port 8080Context Scaling From 4K to 32K
With 62 layers and 16 KV heads, unquantized FP16 KV cache adds 0.484 MB per token (~4.0 GB at 8K context, ~15.9 GB at 32K). On a 24 GB RTX 3090 or RTX 4090, 8K context fits out of the box, while 16K–32K prompts require setting OLLAMA_KV_CACHE_TYPE=q8_0.
| Context Length | FP16 KV Cache | Total at Q4_K_M | Minimum Fitting Hardware |
|---|---|---|---|
| 4K | 1.9 GB | 20.0 GB | 24 GB GPU (RTX 4090) |
| 8K | 3.9 GB | 21.9 GB | 24 GB GPU (RTX 4090) |
| 16K | 7.7 GB | 25.8 GB | 32–36 GB Mac or 24 GB + KV quant |
| 32K | 15.5 GB | 33.5 GB | 48 GB GPU / 64 GB Mac |
Memory Needed per Quantization
| Quantization | Weights | Total at 8K | Fits on |
|---|---|---|---|
| FP16 | 54.8 GB | 62.0 GB | Mac Studio 128GB |
| Q4_K_M | 16.6 GB | 21.9 GB | Mac Studio 128GB, Mac Studio 64GB, RTX 4090, RTX 5090 |
| Q5_K_M | 19.5 GB | 25.0 GB | Mac Studio 128GB, Mac Studio 64GB, RTX 5090 |
| Q8_0 | 29.1 GB | 35.0 GB | Mac Studio 128GB, Mac Studio 64GB |
Gemma Terms of Use Summary
Google Gemma Terms of Use permit commercial use, fine-tuning and redistribution subject to Google prohibited-use rules. Review the full terms at ai.google.dev/gemma/….