MoE layer
×MLA and a mixture of experts, each added to the residual stream; layers 4–61.
All 47 steps
- in
- [B batch, T positions, 7168 d] [T positions, 32 pairs] [T queries, T keys]
- out
- [B batch, T positions, 7168 d]
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 layer’s norm receives no residual (model.py 302–306, 844–849, 907).
Parameters11,521,245,696 × 58 layers
11,521,245,696 parameters per MoE layer, across its learned components
| Component | Parameters |
|---|---|
| Attention RMSNorm | 7,168 |
| Sparse latent attention | 201,066,752 |
| MoE RMSNorm | 7,168 |
| Mixture of experts | 11,320,164,608 |
| Per-instance total | 11,521,245,696 |
One of 58 independent MoE layers.
Sources
In codeBlock(layer_id, args)
Direct evidence
A layer applies attention-norm, MLA, ffn-norm and the FFN; the first n_dense_layers layers use the dense MLP, the rest MoE. Residual additions happen inside the next normalization.
model.py 826–851 ↗ · deepseek-ai/DeepSeek-V3.2-Exp @ 87e509a2e5a1
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