61 transformer blocks
learnedBlock(layer_id, args)
MLA and a mixture of experts, each added to the residual stream; blocks 4–61.
All 43 steps
- in
- [B batch, T positions, 7168 d] [T positions, 32 pairs] [T queries, T keys]
- out
- [B batch, T positions, 7168 d]
- parameters
- 11,521,245,696 · × 58 MoE blocks = 668,232,250,368
Each residual addition runs in float32 inside the next RMSNorm, which returns the normalized sum and the sum, both cast back to bfloat16, the sum as the new stream; the first block’s norm receives no residual (model.py 302–306, 844–849, 907).
Parameters
11,521,245,696 parameters per MoE block, across its learned components
| Component | Calculation | Parameters |
|---|---|---|
| Attention RMSNorm | 7,168 | |
| Multi-head latent attention | 201,066,752 across its components | 201,066,752 |
| MoE RMSNorm | 7,168 | |
| Mixture of experts | 11,320,164,608 across its components | 11,320,164,608 |
| Per-instance total | 11,521,245,696 | |
Across 58 independent MoE blocks: parameters.
Derived from the pinned reference configuration and inference code. Checkpoint tensors have not been independently counted; FP8 block scales and the multi-token-prediction module are not counted.
Codemodel.py 826–829, 844–851
self.attn = MLA(args)
self.ffn = MLP(args.dim, args.inter_dim) if layer_id < args.n_dense_layers else MoE(args)
self.attn_norm = RMSNorm(args.dim)
self.ffn_norm = RMSNorm(args.dim) if residual is None:
x, residual = self.attn_norm(x), x
else:
x, residual = self.attn_norm(x, residual)
x = self.attn(x, start_pos, freqs_cis, mask)
x, residual = self.ffn_norm(x, residual)
x = self.ffn(x)
return x, residualSources1
Direct evidence
A block applies attention-norm, MLA, ffn-norm and the FFN; the first n_dense_layers blocks use the dense MLP, the rest MoE. Residual additions happen inside the next normalization.
block · deepseek-ai/DeepSeek-V3.2-Exp / inference/model.py
Pinned revision 87e509a2e5a1 ↗ · lines 826–851
Read code excerpt
self.attn = MLA(args)
self.ffn = MLP(args.dim, args.inter_dim) if layer_id < args.n_dense_layers else MoE(args)
self.attn_norm = RMSNorm(args.dim)
self.ffn_norm = RMSNorm(args.dim)… lines 830–843 omitted …
if residual is None:
x, residual = self.attn_norm(x), x
else:
x, residual = self.attn_norm(x, residual)
x = self.attn(x, start_pos, freqs_cis, mask)
x, residual = self.ffn_norm(x, residual)
x = self.ffn(x)
return x, residual