The feed-forward layer in LLaMA multiplies two projections of the input, one of them passed through a SiLU (Swish) nonlinearity. This gated linear unit, called SwiGLU, performs better than the plain ReLU MLP at similar size.
Implement swiglu(x, W, V), returning silu(x W) * (x V).
silu(z) = z * sigmoid(z).Project with W, apply silu, project with V, and multiply element-wise.
No results yet
Run your code to check it against the examples, or submit to run every test.