Llama · Meta

Llama 4 Maverick (17B-128E)

Llama 4 Maverick (17B-128E) from Meta has 400,711,848,960 parameters in its language model, of which about 17.2B are used for each token (a mixture of experts). Its weights take 801 GB in BF16 and about 200 GB at 4-bit, and each token of context adds 196.6 KB of KV cache (6.4 GB at 32K tokens). The checkpoint also carries a 872M-parameter vision encoder.

401Bparameters
17.2Bactive per token
801 GBBF16 weights
200 GB4-bit weights
196.6 KBKV per token

Part of the Llama 4 family: 108B · 401B

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

Architecture

ArchitectureLlama4ForConditionalGeneration
Layers (L)48
Hidden size (d)5,120
AttentionGQA (5 query heads share each KV head)
Heads40 query, 8 key/value, 128 each
Feed-forward128 experts of 8,192, 1 per token, plus 1 shared (SwiGLU); 24 dense layers (even layers 0, 2, …, 46) with FFN 16,384
Vocabulary (V)202,048
Tied embeddingsno: separate output head
Biasesnone
Extra normspre-norm (RMSNorm before attention and FFN)
Max context262,144 tokens; 36 of 48 layers attend only within 8,192-token chunks (the rest, which skip RoPE, see the whole context)
Vision encoderViT, 34 layers, 1,408 wide: 872M parameters with the projector (in the checkpoint, used only for images)
Weights in the releasebfloat16

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
FP3241.6 TB1492.77 GiB
BF16 / FP162801 GB746.38 GiB
INT8 / FP81401 GB373.19 GiB
INT40.5200 GB186.60 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.7 GB in BF16 when images are 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):

GPU memoryBF168-bit4-bit
8 GB–––
12 GB–––
16 GB–––
24 GB–––
48 GB–––
80 GB–––

KV cache

Every layer keeps a key and a value vector for each of its 8 KV heads, for every token in the context:

2 × L × K × h × 2 bytes = 2 × 48 × 8 × 128 × 2 = 196,608 bytes per token

Grouped-query attention is why this is small: with a KV head for each of the 40 query heads it would be 5 times larger.

ContextKV cache, BF168-bit KVWith the chunksWeights + KV, BF16
4K805 MB403 MB805 MB802 GB
32K6.4 GB3.2 GB2.8 GB808 GB
128K25.8 GB12.9 GB7.7 GB827 GB
256K (max)51.5 GB25.8 GB14.1 GB853 GB

In the config, 36 of 48 layers attend only within 8,192-token chunks (the rest, which skip RoPE, see the whole context). Runtimes that honour it never cache more than 8,192 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 48 times (in two kinds).

TensorShapeParameters
Embedding
model.embed_tokens.weight[202,048, 5,120]1,034,485,760
Dense blocks (even layers 0, 2, …, 46): model.layers.N.…
self_attn.q_proj.weight[5,120, 5,120]26,214,400
self_attn.k_proj.weight[1,024, 5,120]5,242,880
self_attn.v_proj.weight[1,024, 5,120]5,242,880
self_attn.o_proj.weight[5,120, 5,120]26,214,400
feed_forward.gate_proj.weight[16,384, 5,120]83,886,080
feed_forward.up_proj.weight[16,384, 5,120]83,886,080
feed_forward.down_proj.weight[5,120, 16,384]83,886,080
input_layernorm.weight[5,120]5,120
post_attention_layernorm.weight[5,120]5,120
MoE blocks (odd layers 1, 3, …, 47): model.layers.N.…
self_attn.q_proj.weight[5,120, 5,120]26,214,400
self_attn.k_proj.weight[1,024, 5,120]5,242,880
self_attn.v_proj.weight[1,024, 5,120]5,242,880
self_attn.o_proj.weight[5,120, 5,120]26,214,400
feed_forward.router.weightthe router: one score per expert[128, 5,120]655,360
feed_forward.experts.gate_up_projevery expert's gate and up in one tensor, stored [in, out]128 × [5,120, 16,384]10,737,418,240
feed_forward.experts.down_proj128 × [8,192, 5,120]5,368,709,120
feed_forward.shared_expert.gate_proj.weightshared expert: runs for every token[8,192, 5,120]41,943,040
feed_forward.shared_expert.up_proj.weightshared expert: runs for every token[8,192, 5,120]41,943,040
feed_forward.shared_expert.down_proj.weightshared expert: runs for every token[5,120, 8,192]41,943,040
input_layernorm.weight[5,120]5,120
post_attention_layernorm.weight[5,120]5,120
After the last block
model.norm.weightfinal norm[5,120]5,120
lm_head.weightscores every token in the vocabulary[202,048, 5,120]1,034,485,760
Vision encoder: patches and positions
vision_model.patch_embedding.linear.weighteach 14×14 patch, flattened[1,408, 588]827,904
vision_model.class_embedding[1,408]1,408
vision_model.positional_embedding_vlmone per patch of a 336×336 tile, plus the class token[577, 1,408]812,416
vision_model.layernorm_pre.weight[1,408]1,408
vision_model.layernorm_pre.bias[1,408]1,408
Vision encoder: one layer (×34): …layers.N.…
self_attn.q_proj.weight[1,408, 1,408]1,982,464
self_attn.q_proj.bias[1,408]1,408
self_attn.k_proj.weight[1,408, 1,408]1,982,464
self_attn.k_proj.bias[1,408]1,408
self_attn.v_proj.weight[1,408, 1,408]1,982,464
self_attn.v_proj.bias[1,408]1,408
self_attn.o_proj.weight[1,408, 1,408]1,982,464
self_attn.o_proj.bias[1,408]1,408
mlp.fc1.weight[5,632, 1,408]7,929,856
mlp.fc1.bias[5,632]5,632
mlp.fc2.weight[1,408, 5,632]7,929,856
mlp.fc2.bias[1,408]1,408
input_layernorm.weight[1,408]1,408
input_layernorm.bias[1,408]1,408
post_attention_layernorm.weight[1,408]1,408
post_attention_layernorm.bias[1,408]1,408
Vision encoder: final norm, adapter and projector
vision_model.layernorm_post.weight[1,408]1,408
vision_model.layernorm_post.bias[1,408]1,408
vision_model.vision_adapter.mlp.fc1.weightafter a pixel shuffle merges 2×2 patches[4,096, 5,632]23,068,672
vision_model.vision_adapter.mlp.fc2.weight[4,096, 4,096]16,777,216
multi_modal_projector.linear_1.weight[5,120, 4,096]20,971,520

The parameter count, step by step

Each line gives the formula, the numbers from config.json, and the subtotal. The symbols:

V
vocabulary 202,048
d
hidden size 5,120
L
layers 48
H
query heads 40
K
key/value heads 8
h
head size 128
f
FFN hidden size 16,384
E
routed experts 128
k
experts per token 1
f_e
expert FFN size 8,192

1. Embedding

One row of d numbers for each of the V tokens in the vocabulary.

Embedding
V × d
202,048 × 5,120
= 1,034,485,760

2. Dense blocks (even layers 0, 2, …, 46), ×24

Attention
H·h × d + 2 × (K·h × d) + d × H·h
5,120 × 5,120 + 2 × (1,024 × 5,120) + 5,120 × 5,120
= 62,914,560
Feed-forward (SwiGLU)
2 × (f × d) + d × f
2 × (16,384 × 5,120) + 5,120 × 16,384
= 251,658,240
Norms
2 × d
2 × 5,120
= 10,240
One block
attention + feed-forward + norms
62,914,560 + 251,658,240 + 10,240
= 314,583,040
24 blocks
24 × block
24 × 314,583,040
= 7,549,992,960

3. MoE blocks (odd layers 1, 3, …, 47), ×24

Attention
H·h × d + 2 × (K·h × d) + d × H·h
5,120 × 5,120 + 2 × (1,024 × 5,120) + 5,120 × 5,120
= 62,914,560
Mixture of experts (128 experts, 1 per token)
E × d + E × (d × 2f_e) + E × (f_e × d) + 2 × (f_e × d) + d × f_e
128 × 5,120 + 128 × (5,120 × 16,384) + 128 × (8,192 × 5,120) + 2 × (8,192 × 5,120) + 5,120 × 8,192
= 16,232,611,840
Norms
2 × d
2 × 5,120
= 10,240
One block
attention + mixture of experts + norms
62,914,560 + 16,232,611,840 + 10,240
= 16,295,536,640
24 blocks
24 × block
24 × 16,295,536,640
= 391,092,879,360

4. Final norm and output head

Final norm + head
d + V × d
5,120 + 202,048 × 5,120
= 1,034,490,880

5. Total

Language model
embedding + blocks + final
1,034,485,760 + 7,549,992,960 + 391,092,879,360 + 1,034,490,880
= 400,711,848,960

6. Active parameters per token

The router sends each token to 1 of the 128 experts in each MoE block, so only those experts' weights are used, plus the shared expert, which every token uses. One routed expert is 125,829,120 parameters.

Active
total − MoE blocks × (E − k) × expert
400,711,848,960 − 24 × 127 × 125,829,120
= 17,184,691,200

7. Vision encoder

The checkpoint also holds an image encoder (Llama 4's own ViT, 34 layers of width d_v = 1,408, MLP f_v = 5,632) 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 + 3 × d_v + (img/p)²+1 × d_v
1,408 × 588 + 3 × 1,408 + 577 × 1,408
= 1,644,544

one layer, ×34

Attention
4 × (d_v × d_v) + 4 × d_v
4 × (1,408 × 1,408) + 4 × 1,408
= 7,935,488
MLP
f_v × d_v + f_v + d_v × f_v + d_v
5,632 × 1,408 + 5,632 + 1,408 × 5,632 + 1,408
= 15,866,752
LayerNorms
4 × d_v
4 × 1,408
= 5,632
One block
attention + mlp + layernorms
7,935,488 + 15,866,752 + 5,632
= 23,807,872
34 blocks
34 × block
34 × 23,807,872
= 809,467,648

final norm, adapter and projector

Into the language model
2 × d_v + a_in × f_v + a_out × a_out + d × a_out
2 × 1,408 + 4,096 × 5,632 + 4,096 × 4,096 + 5,120 × 4,096
= 60,820,224
Vision encoder
the parts above
1,644,544 + 809,467,648 + 60,820,224
= 871,932,416
In the checkpoint
language model + vision
400,711,848,960 + 871,932,416
= 401,583,781,376

Hugging Face counts 401,583,781,376 parameters in the unsloth/Llama-4-Maverick-17B-128E 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). Here that is 2 × 17,184,691,200 = 34.4 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 chunk see at most 8,192 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
4K34.4 GFLOPs4.0 GFLOPs38.4 GFLOPs
32K34.4 GFLOPs14.1 GFLOPs48.5 GFLOPs
128K34.4 GFLOPs38.3 GFLOPs72.6 GFLOPs
256K34.4 GFLOPs70.5 GFLOPs104.8 GFLOPs

Training costs about three times the forward pass per token (6N): the backward pass does roughly twice the forward work.

Compare

Llama 4 Maverick (17B-128E) vs DeepSeek-V3 · Compare with any model →

Close in size: Llama 3.1 405B 406B · DeepSeek-V3 671B · DeepSeek-R1 671B · Qwen3 235B-A22B 235B · Mixtral 8x22B 141B

Source

Read from unsloth/Llama-4-Maverick-17B-128E, an ungated copy of meta-llama/Llama-4-Maverick-17B-128E (which needs a sign-in to download), fetched 2026-12-02.