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.

25.2Bparameters
3.82Bactive per token
50.5 GBBF16 weights
12.6 GB4-bit weights
225.3 KBKV per token

Part of the Gemma 4 family: 25.2B · 30.7B

Architecture · VRAM · KV cache · Tensor shapes · Parameter count · FLOPs

Architecture

ArchitectureGemma4ForConditionalGeneration
Layers (L)30
Hidden size (d)2,816
AttentionGQA (8 query heads share each KV head)
Heads16 query, 2 key/value, 512 each
Feed-forward128 experts of 704, 8 per token (GeGLU)
Vocabulary (V)262,144
Tied embeddingsyes: the output head reuses the embedding
Biasesnone
Extra normspre-norm (RMSNorm before attention and FFN)
Max context262,144 tokens; 25 of 30 layers use a 1,024-token sliding window
Local layers16 query and 8 key/value heads of 256 (the global layers have 2 KV heads)
Dense FFN beside the expertsevery layer also runs a dense FFN of 2,112 next to the experts
Vision encoderViT, 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:

PrecisionBytes per parameterWeights
FP324101 GB94.00 GiB
BF16 / FP16250.5 GB47.00 GiB
INT8 / FP8125.2 GB23.50 GiB
INT40.512.6 GB11.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.

Memory calculator

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 memoryBF168-bit4-bit
8 GB52.3 GBtoo big28.7 GBtoo big16.0 GBtoo big
12 GB52.3 GBtoo big28.7 GBtoo big16.0 GBtoo big
16 GB52.3 GBtoo big28.7 GBtoo big16.0 GBtoo big
24 GB52.3 GBtoo big28.7 GBtoo big16.0 GB
48 GB52.3 GBtoo big28.7 GB16.0 GB
64 GB52.3 GB28.7 GB16.0 GB
80 GB52.3 GB28.7 GB16.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.

ContextKV cache, BF168-bit KVWith the sliding windowWeights + KV, BF16
4K923 MB461 MB294 MB51.4 GB
32K7.4 GB3.7 GB881 MB57.8 GB
128K29.5 GB14.8 GB2.9 GB80.0 GB
256K (max)59.1 GB29.5 GB5.6 GB110 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).

TensorShapeParameters
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 tensor128 × [1,408, 2,816]507,510,784
experts.down_proj128 × [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 tensor128 × [1,408, 2,816]507,510,784
experts.down_proj128 × [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.

Embedding
V × d
262,144 × 2,816
= 738,197,504

2. Sliding-window blocks (25 layers), ×25

Attention (sliding window)
H·h × d + 2 × (K·h × d) + d × H·h + 2 × h
4,096 × 2,816 + 2 × (2,048 × 2,816) + 2,816 × 4,096 + 2 × 256
= 34,603,520
Feed-forward (GeGLU)
2 × (f × d) + d × f
2 × (2,112 × 2,816) + 2,816 × 2,112
= 17,842,176
Mixture of experts (128 experts, 8 per token), beside the FFN
E × d + d + E + E × (2f_e × d) + E × (d × f_e)
128 × 2,816 + 2,816 + 128 + 128 × (1,408 × 2,816) + 128 × (2,816 × 704)
= 761,629,568
Norms and scale
7 × d + 1
7 × 2,816 + 1
= 19,713
One block
attention + feed-forward + mixture of experts + norms and scale
34,603,520 + 17,842,176 + 761,629,568 + 19,713
= 814,094,977
25 blocks
25 × block
25 × 814,094,977
= 20,352,374,425

3. Global blocks (every 6th: layers 5, 11, …, 29), ×5

Attention (global)
H·h_g × d + K_g·h_g × d + d × H·h_g + 2 × h_g
8,192 × 2,816 + 1,024 × 2,816 + 2,816 × 8,192 + 2 × 512
= 49,021,952
Feed-forward (GeGLU)
2 × (f × d) + d × f
2 × (2,112 × 2,816) + 2,816 × 2,112
= 17,842,176
Mixture of experts (128 experts, 8 per token), beside the FFN
E × d + d + E + E × (2f_e × d) + E × (d × f_e)
128 × 2,816 + 2,816 + 128 + 128 × (1,408 × 2,816) + 128 × (2,816 × 704)
= 761,629,568
Norms and scale
7 × d + 1
7 × 2,816 + 1
= 19,713
One block
attention + feed-forward + mixture of experts + norms and scale
49,021,952 + 17,842,176 + 761,629,568 + 19,713
= 828,513,409
5 blocks
5 × block
5 × 828,513,409
= 4,142,567,045

4. Final norm and output head

Final norm (the head is the embedding, tied: 0 more)
d
2,816
= 2,816

5. Total

Language model
embedding + blocks + final
738,197,504 + 20,352,374,425 + 4,142,567,045 + 2,816
= 25,233,141,790

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.

Active
total − MoE blocks × (E − k) × expert
25,233,141,790 − 30 × 120 × 5,947,392
= 3,822,530,590

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

Patch embedding
d_v × C·p·p + 2 × n_pos × d_v
1,152 × 768 + 2 × 10,240 × 1,152
= 24,477,696

one layer, ×27

Attention
4 × (d_v × d_v) + 2 × h_v
4 × (1,152 × 1,152) + 2 × 72
= 5,308,560
MLP (gated)
2 × (f_v × d_v) + d_v × f_v
2 × (4,304 × 1,152) + 1,152 × 4,304
= 14,874,624
Norms
4 × d_v
4 × 1,152
= 4,608
One block
attention + mlp + norms
5,308,560 + 14,874,624 + 4,608
= 20,187,792
27 blocks
27 × block
27 × 20,187,792
= 545,070,384

output and projector

Into the language model
2 × d_v + d × d_v
2 × 1,152 + 2,816 × 1,152
= 3,246,336
Vision encoder
the parts above
24,477,696 + 545,070,384 + 3,246,336
= 572,794,416
In the checkpoint
language model + vision
25,233,141,790 + 572,794,416
= 25,805,936,206

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 T2NAttentionTotal per token
4K7.6 GFLOPs1.1 GFLOPs8.7 GFLOPs
32K7.6 GFLOPs5.8 GFLOPs13.4 GFLOPs
128K7.6 GFLOPs21.9 GFLOPs29.5 GFLOPs
256K7.6 GFLOPs43.4 GFLOPs51.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.