SwiGLU MLP

Down projection

×

Map 18,432 gated features back to 7,168 features.

Δffn=hW2{\htmlData{light=output down}{\Delta_{\mathrm{ffn}}}}={\htmlData{light=h product}{h}}W_{2}
in
hh [B batch, T positions, 18432 d_ff]
out
Δffn\Delta_{\mathrm{ffn}} [B batch, T positions, 7168 d]
Parameters132,120,576

132,120,576 parameters per instance.

ComponentCalculationParameters
Weight matrix18,432 × 7,168132,120,576

This projection has no bias parameter.

The reference module holds the weight output by input, [out, in].

Sources

In codeself.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))

Open pinned code ↗

Direct evidence

The dense feed-forward network is a SwiGLU MLP: down(silu(gate x) ⊙ up x).

modeling_deepseek.py 374–390 ↗ · moonshotai/Kimi-K2-Instruct @ fd1984e2b7a3

Excerpt
class DeepseekV3MLP(nn.Module):
    def __init__(self, config, hidden_size=None, intermediate_size=None):
        super().__init__()
        self.config = config
        self.hidden_size = config.hidden_size if hidden_size is None else hidden_size
        self.intermediate_size = (
            config.intermediate_size if intermediate_size is None else intermediate_size
        )

        self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
        self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
        self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
        self.act_fn = ACT2FN[config.hidden_act]

    def forward(self, x):
        down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
        return down_proj

Weights are stored in FP8 (e4m3) with one scale per 128 × 128 block; the scales are quantization metadata and are excluded from parameter counts.

config.json 38–46 ↗ · moonshotai/Kimi-K2-Instruct @ fd1984e2b7a3

Excerpt
  "quantization_config": {
    "activation_scheme": "dynamic",
    "fmt": "e4m3",
    "quant_method": "fp8",
    "weight_block_size": [
      128,
      128
    ]
  },