Llama · Meta
Llama 4 Scout (17B-16E)
Llama 4 Scout (17B-16E) from Meta has 107,769,861,120 parameters in its language model, of which about 17.2B are used for each token (a mixture of experts). Its weights take 216 GB in BF16 and about 53.9 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 | 16 experts of 8,192, 1 per token, plus 1 shared (SwiGLU) |
| Vocabulary (V) | 202,048 |
| Tied embeddings | no: separate output head |
| Biases | none |
| Extra norms | L2 norm on q and k (no weights) |
| 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 | 431 GB | 401.47 GiB |
| BF16 / FP16 | 2 | 216 GB | 200.74 GiB |
| INT8 / FP8 | 1 | 108 GB | 100.37 GiB |
| INT4 | 0.5 | 53.9 GB | 50.18 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 | 216 GB |
| 32K | 6.4 GB | 3.2 GB | 2.8 GB | 222 GB |
| 128K | 25.8 GB | 12.9 GB | 7.7 GB | 241 GB |
| 256K (max) | 51.5 GB | 25.8 GB | 14.1 GB | 267 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.
| Tensor | Shape | Parameters |
|---|---|---|
| Embedding | ||
model.embed_tokens.weight | [202,048, 5,120] | 1,034,485,760 |
| Every block: 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 | [16, 5,120] | 81,920 |
feed_forward.experts.gate_up_projevery expert's gate and up in one tensor, stored [in, out] | 16 × [5,120, 16,384] | 1,342,177,280 |
feed_forward.experts.down_proj | 16 × [8,192, 5,120] | 671,088,640 |
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
- E
- routed experts 16
- 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. Every block, ×48
3. Final norm and output head
4. Total
5. Active parameters per token
The router sends each token to 1 of the 16 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.
6. 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 108,641,793,536 parameters in the unsloth/Llama-4-Scout-17B-16E 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,172,894,720 = 34.3 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.3 GFLOPs | 4.0 GFLOPs | 38.4 GFLOPs |
| 32K | 34.3 GFLOPs | 14.1 GFLOPs | 48.4 GFLOPs |
| 128K | 34.3 GFLOPs | 38.3 GFLOPs | 72.6 GFLOPs |
| 256K | 34.3 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 Scout (17B-16E) vs Llama 3.3 70B · Llama 4 Scout (17B-16E) vs gpt-oss-120b · Compare with any model →
Close in size: gpt-oss-120b 117B · Mixtral 8x22B 141B · Qwen2.5 72B 72.7B · Llama 3.1 70B 70.6B · Llama 3.3 70B 70.6B
Source
Read from unsloth/Llama-4-Scout-17B-16E, an ungated copy of meta-llama/Llama-4-Scout-17B-16E (which needs a sign-in to download), fetched 2026-12-02.