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.
Part of the Llama 4 family: 108B · 401B
Architecture · VRAM · KV cache · Tensor shapes · Parameter count · FLOPs
Architecture
| Architecture | Llama4ForConditionalGeneration |
|---|---|
| Layers (L) | 48 |
| Hidden size (d) | 5,120 |
| Attention | GQA (5 query heads share each KV head) |
| Heads | 40 query, 8 key/value, 128 each |
| Feed-forward | 128 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 embeddings | no: separate output head |
| Biases | none |
| Extra norms | pre-norm (RMSNorm before attention and FFN) |
| Max context | 262,144 tokens; 36 of 48 layers attend only within 8,192-token chunks (the rest, which skip RoPE, see the whole context) |
| Vision encoder | ViT, 34 layers, 1,408 wide: 872M parameters with the projector (in the checkpoint, used only for images) |
| Weights in the release | bfloat16 |
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 | 1.6 TB | 1492.77 GiB |
| BF16 / FP16 | 2 | 801 GB | 746.38 GiB |
| INT8 / FP8 | 1 | 401 GB | 373.19 GiB |
| INT4 | 0.5 | 200 GB | 186.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.
On common GPUs
Whether the weights plus a 8K-token KV cache fit in 90% of the card (how this is worked out):
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.
| Context | KV cache, BF16 | 8-bit KV | With the chunks | Weights + KV, BF16 |
|---|---|---|---|---|
| 4K | 805 MB | 403 MB | 805 MB | 802 GB |
| 32K | 6.4 GB | 3.2 GB | 2.8 GB | 808 GB |
| 128K | 25.8 GB | 12.9 GB | 7.7 GB | 827 GB |
| 256K (max) | 51.5 GB | 25.8 GB | 14.1 GB | 853 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).
| Tensor | Shape | Parameters |
|---|---|---|
| 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_proj | 128 × [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.
2. Dense blocks (even layers 0, 2, …, 46), ×24
3. MoE blocks (odd layers 1, 3, …, 47), ×24
4. Final norm and output head
5. Total
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.
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
one layer, ×34
final norm, adapter and projector
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 T | 2N | Attention | Total per token |
|---|---|---|---|
| 4K | 34.4 GFLOPs | 4.0 GFLOPs | 38.4 GFLOPs |
| 32K | 34.4 GFLOPs | 14.1 GFLOPs | 48.5 GFLOPs |
| 128K | 34.4 GFLOPs | 38.3 GFLOPs | 72.6 GFLOPs |
| 256K | 34.4 GFLOPs | 70.5 GFLOPs | 104.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.