62 Downloads Updated 1 week ago
ollama run dna5rm/gemma4:12b-8k
Updated 1 week ago
1 week ago
157ed494d129 · 7.6GB ·
dna5rm/gemma4:12b-8k is a context-optimized derivative of gemma4:12b that caps the default context window at 8,192 tokens. The base Gemma 4 12B ships with a 262K-token context that requires ~38 GB of KV cache alone -impossible on any consumer GPU. This variant sets a sane default so the model loads and runs on a 12 GB GPU without requiring clients to pass options.num_ctx on every request.
No weights are modified. The model retains the full 11.9B parameters (Q4_K_M quantization, 7.6 GB on disk), the CLIP vision projector (52.38M parameters), and all base model capabilities: completion, vision, audio, tools, and thinking.
| Property | Value |
|---|---|
| Architecture | gemma4 |
| Parameters | 11.9B |
| Quantization | Q4_K_M |
| File Size | 7.6 GB |
| Context Length (native) | 262,144 tokens |
| Context Length (default) | 8,192 tokens |
| Embedding Length | 3,840 |
| Vision Projector | CLIP, 52.38M params |
| License | Apache 2.0 |
| Requires | Ollama 0.30.5+ |
{
"num_ctx": 8192,
"temperature": 1,
"top_k": 64,
"top_p": 0.95
}
These match Google’s recommended sampling configuration for Gemma 4.
The upstream gemma4:12b defaults to 262K context. On a 12 GB GPU (e.g. RTX A2000):
| Context | KV Cache | Total VRAM | Fits 12 GB? |
|---|---|---|---|
| 8,192 | ~2.4 GB | ~10 GB | Yes |
| 131,072 | ~38 GB | ~46 GB | No |
| 262,144 | ~76 GB | ~84 GB | No |
Without an explicit num_ctx override on every API call, the model loads with the full 262K context and immediately overflows VRAM. This variant sets 8K as the default so it just works.
Clients can still request a larger context per-call via options.num_ctx if VRAM allows.
# Pull
ollama pull dna5rm/gemma4:12b-8k
# Run
ollama run dna5rm/gemma4:12b-8k
# API (OpenAI-compatible)
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "dna5rm/gemma4:12b-8k",
"messages": [{"role": "user", "content": "Describe this image."}],
"images": ["<base64-encoded-image>"]
}'
options.num_ctx in your API request. Ensure your GPU has enough VRAM for the larger KV cache.General-purpose multimodal assistant tasks: reasoning, agentic workflows, coding, and image understanding. Suitable for single-GPU homelab and edge deployments where VRAM is the bottleneck.
Built from gemma4:12b by Google DeepMind. See the upstream model card for full benchmark results, training details, and architecture specifications.