Gemma · Google
Gemma 4 26B-A4B
Gemma 4 26B-A4B from Google has 25,233,141,790 parameters in its language model, of which about 3.82B are used for each token (a mixture of experts). Its weights take 50.5 GB in BF16 and about 12.6 GB at 4-bit, and each token of context adds 225.3 KB of KV cache (7.4 GB at 32K tokens). The checkpoint also carries a 573M-parameter vision encoder.
Part of the Gemma 4 family: 25.2B · 30.7B
Architecture · VRAM · KV cache · Tensor shapes · Parameter count · FLOPs
Architecture
| Architecture | Gemma4ForConditionalGeneration |
|---|---|
| Layers (L) | 30 |
| Hidden size (d) | 2,816 |
| Attention | GQA (8 query heads share each KV head) |
| Heads | 16 query, 2 key/value, 512 each |
| Feed-forward | 128 experts of 704, 8 per token (GeGLU) |
| Vocabulary (V) | 262,144 |
| Tied embeddings | yes: the output head reuses the embedding |
| Biases | none |
| Extra norms | pre-norm (RMSNorm before attention and FFN) |
| Max context | 262,144 tokens; 25 of 30 layers use a 1,024-token sliding window |
| Local layers | 16 query and 8 key/value heads of 256 (the global layers have 2 KV heads) |
| Dense FFN beside the experts | every layer also runs a dense FFN of 2,112 next to the experts |
| Vision encoder | ViT, 27 layers, 1,152 wide: 573M parameters with the projector (in the checkpoint, used only for images) |
| Weights in the release | – |
How much memory the weights need
Each parameter takes 4 bytes in FP32, 2 in BF16, 1 at 8 bits and half a byte at 4 bits, so the weights of the language model alone need:
| Precision | Bytes per parameter | Weights | |
|---|---|---|---|
| FP32 | 4 | 101 GB | 94.00 GiB |
| BF16 / FP16 | 2 | 50.5 GB | 47.00 GiB |
| INT8 / FP8 | 1 | 25.2 GB | 23.50 GiB |
| INT4 | 0.5 | 12.6 GB | 11.75 GiB |
GB here is 109 bytes; GiB (230) is what tools like nvidia-smi show. Real 4-bit files are a little larger: they also store scales, and some layers are often kept at higher precision. The vision encoder adds 1.1 GB in BF16 when used. Every expert has to be in memory, not just the active ones: the router picks different experts for each token. A running model also needs its KV cache, activations and the runtime's own buffers.
On common GPUs
Whether the weights plus a 8K-token KV cache fit in 90% of the card (how this is worked out):
Smallest card: 64 GB at BF16, 48 GB at 8-bit, 24 GB at 4-bit.
| GPU memory | BF16 | 8-bit | 4-bit |
|---|---|---|---|
| 8 GB | 52.3 GBtoo big | 28.7 GBtoo big | 16.0 GBtoo big |
| 12 GB | 52.3 GBtoo big | 28.7 GBtoo big | 16.0 GBtoo big |
| 16 GB | 52.3 GBtoo big | 28.7 GBtoo big | 16.0 GBtoo big |
| 24 GB | 52.3 GBtoo big | 28.7 GBtoo big | 16.0 GB |
| 48 GB | 52.3 GBtoo big | 28.7 GB | 16.0 GB |
| 64 GB | 52.3 GB | 28.7 GB | 16.0 GB |
| 80 GB | 52.3 GB | 28.7 GB | 16.0 GB |
Each cell is the weights plus the 8K-token KV cache at that precision; ✓ where it fits.
KV cache
What it is: the KV cache, explained.
Only some layers keep keys and values, and not all of the same size:
5 global layers × 2 × 2 × 512 + 25 sliding-window layers × 2 × 8 × 256 × 2 bytes = 225,280 bytes per token
The global layers reuse their keys as values, so a runtime could keep one copy; the figure counts both, as most runtimes do.
| Context | KV cache, BF16 | 8-bit KV | With the sliding window | Weights + KV, BF16 |
|---|---|---|---|---|
| 4K | 923 MB | 461 MB | 294 MB | 51.4 GB |
| 32K | 7.4 GB | 3.7 GB | 881 MB | 57.8 GB |
| 128K | 29.5 GB | 14.8 GB | 2.9 GB | 80.0 GB |
| 256K (max) | 59.1 GB | 29.5 GB | 5.6 GB | 110 GB |
In the config, 25 of 30 layers use a 1,024-token sliding window. Runtimes that honour it never cache more than 1,024 tokens for those layers; the column shows what that saves.
For one sequence. Batching multiplies the KV cache by the number of sequences, not the weights.
Every tensor shape
The names are those in the Hugging Face checkpoint (the language model's sit under language_model.); shapes are [out, in] for weight matrices, as PyTorch stores them. One block is shown: the model repeats it 30 times (in two kinds).
| Tensor | Shape | Parameters |
|---|---|---|
| Embedding | ||
model.language_model.embed_tokens.weightalso used as the output head (tied) | [262,144, 2,816] | 738,197,504 |
| Sliding-window blocks (25 layers): model.layers.N.… | ||
self_attn.q_proj.weight | [4,096, 2,816] | 11,534,336 |
self_attn.k_proj.weight | [2,048, 2,816] | 5,767,168 |
self_attn.v_proj.weight | [2,048, 2,816] | 5,767,168 |
self_attn.o_proj.weight | [2,816, 4,096] | 11,534,336 |
self_attn.q_norm.weightshared by every head | [256] | 256 |
self_attn.k_norm.weight | [256] | 256 |
mlp.gate_proj.weight | [2,112, 2,816] | 5,947,392 |
mlp.up_proj.weight | [2,112, 2,816] | 5,947,392 |
mlp.down_proj.weight | [2,816, 2,112] | 5,947,392 |
router.proj.weightthe router | [128, 2,816] | 360,448 |
router.scalescales the input to the router | [2,816] | 2,816 |
router.per_expert_scale | [128] | 128 |
experts.gate_up_projevery expert's gate and up, one tensor | 128 × [1,408, 2,816] | 507,510,784 |
experts.down_proj | 128 × [2,816, 704] | 253,755,392 |
input_layernorm.weight | [2,816] | 2,816 |
post_attention_layernorm.weight | [2,816] | 2,816 |
pre_feedforward_layernorm.weight | [2,816] | 2,816 |
post_feedforward_layernorm.weight | [2,816] | 2,816 |
pre_feedforward_layernorm_2.weight | [2,816] | 2,816 |
post_feedforward_layernorm_1.weight | [2,816] | 2,816 |
post_feedforward_layernorm_2.weight | [2,816] | 2,816 |
layer_scalarone learned scale for the block | [1] | 1 |
| Global blocks (every 6th: layers 5, 11, …, 29): model.layers.N.… | ||
self_attn.q_proj.weight | [8,192, 2,816] | 23,068,672 |
self_attn.k_proj.weightthe keys are also the values: there is no v_proj | [1,024, 2,816] | 2,883,584 |
self_attn.o_proj.weight | [2,816, 8,192] | 23,068,672 |
self_attn.q_norm.weightshared by every head | [512] | 512 |
self_attn.k_norm.weight | [512] | 512 |
mlp.gate_proj.weight | [2,112, 2,816] | 5,947,392 |
mlp.up_proj.weight | [2,112, 2,816] | 5,947,392 |
mlp.down_proj.weight | [2,816, 2,112] | 5,947,392 |
router.proj.weightthe router | [128, 2,816] | 360,448 |
router.scalescales the input to the router | [2,816] | 2,816 |
router.per_expert_scale | [128] | 128 |
experts.gate_up_projevery expert's gate and up, one tensor | 128 × [1,408, 2,816] | 507,510,784 |
experts.down_proj | 128 × [2,816, 704] | 253,755,392 |
input_layernorm.weight | [2,816] | 2,816 |
post_attention_layernorm.weight | [2,816] | 2,816 |
pre_feedforward_layernorm.weight | [2,816] | 2,816 |
post_feedforward_layernorm.weight | [2,816] | 2,816 |
pre_feedforward_layernorm_2.weight | [2,816] | 2,816 |
post_feedforward_layernorm_1.weight | [2,816] | 2,816 |
post_feedforward_layernorm_2.weight | [2,816] | 2,816 |
layer_scalarone learned scale for the block | [1] | 1 |
| After the last block | ||
model.language_model.norm.weightfinal norm | [2,816] | 2,816 |
| Vision encoder: patches and positions | ||
model.vision_tower.patch_embedder.input_proj.weighteach 16×16 patch, flattened | [1,152, 768] | 884,736 |
model.vision_tower.patch_embedder.position_embedding_tablea learned table for each axis, rows and columns | [2, 10,240, 1,152] | 23,592,960 |
| Vision encoder: one layer (×27): …layers.N.… | ||
self_attn.q_proj.linear.weight | [1,152, 1,152] | 1,327,104 |
self_attn.k_proj.linear.weight | [1,152, 1,152] | 1,327,104 |
self_attn.v_proj.linear.weight | [1,152, 1,152] | 1,327,104 |
self_attn.o_proj.linear.weight | [1,152, 1,152] | 1,327,104 |
self_attn.q_norm.weight | [72] | 72 |
self_attn.k_norm.weight | [72] | 72 |
mlp.gate_proj.linear.weight | [4,304, 1,152] | 4,958,208 |
mlp.up_proj.linear.weight | [4,304, 1,152] | 4,958,208 |
mlp.down_proj.linear.weight | [1,152, 4,304] | 4,958,208 |
input_layernorm.weight | [1,152] | 1,152 |
post_attention_layernorm.weight | [1,152] | 1,152 |
pre_feedforward_layernorm.weight | [1,152] | 1,152 |
post_feedforward_layernorm.weight | [1,152] | 1,152 |
| Vision encoder: output and projector | ||
model.vision_tower.std_biasstandardizes the output | [1,152] | 1,152 |
model.vision_tower.std_scale | [1,152] | 1,152 |
model.embed_vision.embedding_projection.weightimage features to the language model's width | [2,816, 1,152] | 3,244,032 |
The parameter count, step by step
Each line gives the formula, the numbers from config.json, and the subtotal. The symbols:
- V
- vocabulary 262,144
- d
- hidden size 2,816
- L
- layers 30
- H
- query heads 16
- K
- key/value heads 2
- h
- head size 512
- E
- routed experts 128
- k
- experts per token 8
- f_e
- expert FFN size 704
1. Embedding
One row of d numbers for each of the V tokens in the vocabulary.
2. Sliding-window blocks (25 layers), ×25
3. Global blocks (every 6th: layers 5, 11, …, 29), ×5
4. Final norm and output head
5. Total
6. Active parameters per token
The router sends each token to 8 of the 128 experts in each MoE block, so only those experts' weights are used. One routed expert is 5,947,392 parameters.
7. Vision encoder
The checkpoint also holds an image encoder (Llama 4's own ViT, 27 layers of width d_v = 1,152, MLP f_v = 4,304) and a projector into the language model. It runs only when the prompt has an image, so it is listed apart from the language model.
patches and positions
one layer, ×27
output and projector
Hugging Face counts 25,805,936,206 parameters in the google/gemma-4-26B-A4B safetensors files. The arithmetic above matches exactly.
FLOPs per token
A forward pass costs about two floating-point operations (a multiply and an add) for every weight a token passes through: 2 × N, with N the active weights used in matrix multiplies (the embedding lookup is a read, not a multiply; the output head is a multiply, even though it is tied to the embedding). Here that is 2 × 3,822,530,590 = 7.6 GFLOPs per token.
Attention adds the work of comparing the token with every earlier one: 2 × L × T × H × (hqk + hv) for T tokens of context, which grows with the context while 2N does not. Layers with a window see at most 1,024 tokens, which the table allows for.
That is for one new token at position T, as when generating. Averaged over a whole training sequence of length T, each token sees T/2 earlier ones on average, which halves it.
| Context T | 2N | Attention | Total per token |
|---|---|---|---|
| 4K | 7.6 GFLOPs | 1.1 GFLOPs | 8.7 GFLOPs |
| 32K | 7.6 GFLOPs | 5.8 GFLOPs | 13.4 GFLOPs |
| 128K | 7.6 GFLOPs | 21.9 GFLOPs | 29.5 GFLOPs |
| 256K | 7.6 GFLOPs | 43.4 GFLOPs | 51.0 GFLOPs |
Training costs about three times the forward pass per token (6N): the backward pass does roughly twice the forward work.
More in the glossary: FLOPs per token · quantization · parameters.
Compare
Gemma 4 26B-A4B vs Qwen3.5 35B-A3B · Compare with any model →
Close in size: Qwen3.5 27B 26.9B · Gemma 3 27B 27B · Mistral Small 3 (24B) 23.6B · Gemma 2 27B 27.2B · gpt-oss-20b 20.9B
Source
Read from google/gemma-4-26B-A4B, fetched 2026-12-03.