SwiGLU MLP

SiLU

×

Activate each gate feature independently.

a=g σ(g){\htmlData{light=a silu}{a}}={\htmlData{light=g gate}{g}}\,\sigma({\htmlData{light=g gate}{g}})
in
gg [B batch, T positions, 18432 d_ff]
out
aa [B batch, T positions, 18432 d_ff]

SiLU and the product run in float32 and are cast back before the down projection (model.py 643).

Explanation

σ(z)=1/(1+e−z){\sigma(z)=1/(1+e^{-z})} is the logistic sigmoid.

Sources

In codeF.silu(self.w1(x).float())

Open pinned code ↗

Direct evidence

The dense feed-forward network is a SwiGLU MLP: w2(silu(w1 x) ⊙ w3 x).

model.py 629–643 ↗ · deepseek-ai/DeepSeek-V3.2 @ a7e62ac04ecb

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))