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.

108Bparameters
17.2Bactive per token
216 GBBF16 weights
53.9 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-forward16 experts of 8,192, 1 per token, plus 1 shared (SwiGLU)
Vocabulary (V)202,048
Tied embeddingsno: separate output head
Biasesnone
Extra normsL2 norm on q and k (no weights)
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
FP324431 GB401.47 GiB
BF16 / FP162216 GB200.74 GiB
INT8 / FP81108 GB100.37 GiB
INT40.553.9 GB50.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.

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 MB216 GB
32K6.4 GB3.2 GB2.8 GB222 GB
128K25.8 GB12.9 GB7.7 GB241 GB
256K (max)51.5 GB25.8 GB14.1 GB267 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.

TensorShapeParameters
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_proj16 × [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.

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

2. Every block, ×48

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 (16 experts, 1 per token)
E × d + E × (d × 2f_e) + E × (f_e × d) + 2 × (f_e × d) + d × f_e
16 × 5,120 + 16 × (5,120 × 16,384) + 16 × (8,192 × 5,120) + 2 × (8,192 × 5,120) + 5,120 × 8,192
= 2,139,176,960
Norms
2 × d
2 × 5,120
= 10,240
One block
attention + mixture of experts + norms
62,914,560 + 2,139,176,960 + 10,240
= 2,202,101,760
48 blocks
L × block
48 × 2,202,101,760
= 105,700,884,480

3. Final norm and output head

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

4. Total

Language model
embedding + blocks + final
1,034,485,760 + 105,700,884,480 + 1,034,490,880
= 107,769,861,120

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.

Active
total − MoE blocks × (E − k) × expert
107,769,861,120 − 48 × 15 × 125,829,120
= 17,172,894,720

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

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
107,769,861,120 + 871,932,416
= 108,641,793,536

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 T2NAttentionTotal per token
4K34.3 GFLOPs4.0 GFLOPs38.4 GFLOPs
32K34.3 GFLOPs14.1 GFLOPs48.4 GFLOPs
128K34.3 GFLOPs38.3 GFLOPs72.6 GFLOPs
256K34.3 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 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.