Gemma 4 Sizes and Memory
| Model | Parameters | Context | 4-bit | 8-bit | 16-bit | Ollama download | Audio input |
|---|---|---|---|---|---|---|---|
| Gemma 4 E2B | 2.3B effective | 128K | 2.9 GB | 5.7 GB | 11.4 GB | 4.6–7.5 GB | Yes |
| Gemma 4 E4B | 4.5B effective | 128K | 4.5 GB | 8.9 GB | 17.9 GB | 6.6–9.5 GB | Yes |
| Gemma 4 12B | 11.95B | 256K | 6.7 GB | 13.4 GB | 26.7 GB | 7.7–8.0 GB | Yes |
| Gemma 4 26B A4B | 25.2B (3.8B active) | 256K | 14.4 GB | 28.8 GB | 57.7 GB | 16–19 GB | No |
| Gemma 4 31B | 30.7B | 256K | 17.5 GB | 34.9 GB | 69.9 GB | 19–20 GB | No |
From Google's Gemma 4 overview, model card and Ollama's library. Google's memory figures cover the weights only: context and software come on top. Every size takes text and images.
Gemma 4 on Our GPU Servers
The largest Gemma 4 that fits each server's total GPU memory, with 4 GB left for the context and engine. A server with several cards splits the model across them; see running an LLM on multiple GPUs.
| Plan | GPU | Total GPU memory | System memory | Largest Gemma 4 | Price |
|---|---|---|---|---|---|
| Intel Core Ultra 9 285K w/ NVIDIA Tesla P4 | NVIDIA Tesla P4 · 8 GB | 8 GB | 192 GB | E2B at 4-bit | $589.00/mo |
| NVIDIA DGX Spark | NVIDIA DGX Spark · 128 GB | 128 GB | 128 GB | 31B at 8-bit | $609.00/mo |
| AMD EPYC 7443P w/ NVIDIA RTX 3090 | NVIDIA RTX 3090 · 24 GB | 24 GB | 256 GB | 31B at 4-bit, 12B at 8-bit | $659.00/mo |
| AMD Ryzen 9 9950X w/ NVIDIA RTX 3050 | NVIDIA RTX 3050 · 6 GB | 6 GB | 192 GB | Partly on the CPU | $699.00/mo |
| AMD Dual EPYC 7702 w/ NVIDIA RTX 3050 | NVIDIA RTX 3050 · 6 GB | 6 GB | 256 GB | Partly on the CPU | $749.00/mo |
| AMD Ryzen 9 9950X w/ NVIDIA RTX 5090 | NVIDIA RTX 5090 · 32 GB | 32 GB | 64 GB | 31B at 4-bit, 12B at 8-bit | $789.00/mo |
| AMD Ryzen 9 9950X w/ NVIDIA RTX 5090 | NVIDIA RTX 5090 · 32 GB | 32 GB | 96 GB | 31B at 4-bit, 12B at 8-bit | $829.00/mo |
| AMD Dual EPYC 7702 w/ NVIDIA RTX 5070 | NVIDIA RTX 5070 · 12 GB | 12 GB | 256 GB | 12B at 4-bit, E2B at 8-bit | $859.00/mo |
| AMD EPYC 7702 w/ 4x NVIDIA RTX 3090 | 4× NVIDIA RTX 3090 · 24 GB each | 96 GB | 128 GB | 31B at 8-bit | $929.00/mo |
| AMD EPYC 7443P w/ 4x NVIDIA V100 16GB | 4× NVIDIA V100 · 16 GB each | 64 GB | 128 GB | 31B at 8-bit | $1,059.00/mo |
| AMD EPYC 7443P w/ 4x NVIDIA V100 32GB | 4× NVIDIA V100 · 32 GB each | 128 GB | 128 GB | 31B at 8-bit | $1,059.00/mo |
| AMD EPYC 7443P w/ 4x NVIDIA V100 | 4× NVIDIA V100 | — | 256 GB | — | $1,189.00/mo |
| Intel Dual Xeon Platinum 8260 w/ 8x NVIDIA V100 | 8× NVIDIA V100 · 32 GB each | 256 GB | 1 TB | 31B at 8-bit | $1,319.00/mo |
| 2x NVIDIA DGX Spark | 2× NVIDIA DGX Spark · 128 GB each | 256 GB | 256 GB | 31B at 8-bit | $1,449.00/mo |
| AMD EPYC 9B14 w/ 2x NVIDIA RTX 5090 | 2× NVIDIA RTX 5090 · 32 GB each | 64 GB | 384 GB | 31B at 8-bit | $2,639.00/mo |
| AMD EPYC 9355 w/ NVIDIA RTX PRO 6000 | NVIDIA RTX PRO 6000 · 96 GB | 96 GB | 768 GB | 31B at 8-bit | $2,639.00/mo |
| AMD EPYC 9254 w/ 4x NVIDIA RTX 5090 | 4× NVIDIA RTX 5090 · 32 GB each | 128 GB | 384 GB | 31B at 8-bit | $3,819.00/mo |
Gemma 4 on a VPS
The smaller models run on the processor with no GPU: fine for classifying, summarising and short answers, slow for long ones. The table leaves 3 GB for the system and a short context, and shows the lowest-priced plan with enough memory. VPS processors are shared, so for constant use run it on a CPU server of your own.
1. Run Gemma 4 With Ollama
curl -fsSL https://ollama.com/install.sh | sh ollama run gemma4:e4b # small servers (also the default, gemma4) ollama run gemma4:26b # fast for its size ollama run gemma4:31b # the largest
Ollama's context is 4,096 tokens unless you raise it. Run sudo systemctl edit ollama.service, add the lines below, then sudo systemctl daemon-reload && sudo systemctl restart ollama. A longer context takes more memory.
[Service] Environment="OLLAMA_CONTEXT_LENGTH=32768"
The tags gemma4:cloud and similar run on Ollama's servers, not yours. Cannot connect? See fixing Ollama connection refused.
2. Run Gemma 4 With llama.cpp
curl -LsSf https://llama.app/install.sh | sh openssl rand -hex 24 > ~/.llm-key llama serve -hf ggml-org/gemma-4-26B-A4B-it-GGUF:Q4_0 \ -c 32768 --host 127.0.0.1 --port 8080 --api-key "$(cat ~/.llm-key)" \ --temp 1.0 --top-p 0.95 --top-k 64
The same repository name with E2B, E4B, 12B or 31B in it gives the other sizes. Google also publishes quantization-aware 4-bit builds, trained to lose less quality, such as gemma-4-31B-it-qat-q4_0-gguf. For the 26B A4B on a small GPU, --n-cpu-moe N keeps the experts of the first N layers in system memory.
3. Serve Gemma 4 With vLLM
For many users, vLLM. Google's quantization-aware build of the 31B for vLLM keeps the weights at 4-bit; vLLM's recipe needs version 0.19.1 or newer:
uv venv && source .venv/bin/activate uv pip install -U vllm --torch-backend auto vllm serve google/gemma-4-31B-it-qat-w4a16-ct \ --max-model-len 16384 \ --reasoning-parser gemma4 \ --host 127.0.0.1 --api-key "$(cat ~/.llm-key)" # OpenAI-compatible API on http://127.0.0.1:8000/v1
Raise --max-model-len as far as memory allows. With two cards add --tensor-parallel-size 2. For tool calls, the recipe adds --enable-auto-tool-choice --tool-call-parser gemma4 and a chat template from vLLM's repository. HTTPS in front is in serving an LLM API.
Thinking Mode and Settings
- Sampling: Google recommends
temperature=1.0,top_p=0.95,top_k=64. - Thinking: on when the system prompt starts with
<|think|>, off without it. Most engines expose it as a setting. - Conversation history: keep only the final answers of earlier turns, not the model's thoughts.
- A chat interface: Open WebUI works with Ollama, llama.cpp and vLLM alike.
Comparing models? See running Qwen4 and running gpt-oss.
Gemma, Google and NVIDIA are trademarks of their respective owners. Virteche is not affiliated with or endorsed by them. Details about their products come from their public documentation as of the date at the top of this guide.