- in
- [B batch, T positions, 7168 d]
- out
- [B batch, T positions, 7168 d]
- parameters
- 396,361,728 · × 3 dense blocks = 1,189,085,184
Parameters
396,361,728 parameters per instance, across its learned components
| Component | Calculation | Parameters |
|---|---|---|
| Gate projection | 132,120,576 | |
| Up projection | 132,120,576 | |
| Down projection | 132,120,576 | |
| Per-instance total | 396,361,728 | |
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.
In numbers
Weights · one MLP
3 × 7,168 × 18,432 = 396,361,728 parameters per MLP in FP8, block scales left out; × 3 dense blocks = 1,189,085,184.
A GELU MLP of the same width has two matrices, 264,241,152 parameters.
config_671B_v3.2.json 3–4model.py 629–631model.py 643config_671B_v3.2.json 21model.py 876model.py 183–187Explanation
The first 3 blocks use this dense MLP; the other 58 replace it with the mixture of experts.
Codemodel.py 629–851
self.w1 = ColumnParallelLinear(dim, inter_dim)
self.w2 = RowParallelLinear(inter_dim, dim, reduce_output=reduce_output)
self.w3 = ColumnParallelLinear(dim, inter_dim) return self.w2((F.silu(self.w1(x).float()) * self.w3(x).float()).type_as(x)) 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, residualSources2
Direct evidence
The dense feed-forward network is a SwiGLU MLP: w2(silu(w1 x) ⊙ w3 x).
mlp · deepseek-ai/DeepSeek-V3.2-Exp / inference/model.py
Pinned revision 87e509a2e5a1 ↗ · lines 629–643
Read code excerpt
self.w1 = ColumnParallelLinear(dim, inter_dim)
self.w2 = RowParallelLinear(inter_dim, dim, reduce_output=reduce_output)
self.w3 = ColumnParallelLinear(dim, inter_dim)… lines 632–642 omitted …
return self.w2((F.silu(self.w1(x).float()) * self.w3(x).float()).type_as(x))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