61 transformer blocks
learnedBlock(layer_id, args)
MLA and a dense SwiGLU MLP, each added to the residual stream; blocks 1–3.
All 32 steps
- in
- [B batch, T positions, 7168 d] [T positions, 32 pairs] [T queries, T keys]
- out
- [B batch, T positions, 7168 d]
- parameters
- 597,442,816 · × 3 dense blocks = 1,792,328,448
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
597,442,816 parameters per dense 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 |
| MLP RMSNorm | 7,168 | |
| SwiGLU MLP | 396,361,728 across its components | 396,361,728 |
| Per-instance total | 597,442,816 | |
Across 3 independent dense 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