SwiGLU

Up features

×

Feature values that the activated gate will modulate.

shape
uu [B batch, T positions, 14336 d_ff]
Sources

In codeself.w3(x)

Open pinned code ↗

Contextual evidence

The MLP owns three bias-free projections. Its forward expression applies SiLU to w1(x), multiplies w3(x) element-wise and projects through w2.

model.py 208–219 ↗ · meta-llama/llama3 @ a0940f9cf706

Excerpt
        self.w1 = ColumnParallelLinear(
            dim, hidden_dim, bias=False, gather_output=False, init_method=lambda x: x
        )
        self.w2 = RowParallelLinear(
            hidden_dim, dim, bias=False, input_is_parallel=True, init_method=lambda x: x
        )
        self.w3 = ColumnParallelLinear(
            dim, hidden_dim, bias=False, gather_output=False, init_method=lambda x: x
        )

    def forward(self, x):
        return self.w2(F.silu(self.w1(x)) * self.w3(x))