Gated Linear Units › Summary

Michael BrenndoerferUpdated June 14, 20252 min read
Language AI HandbookAll chapters
Part 15 of 67Transformer Blocks
Chapter 109Gated Linear Units › Summary
Reading section 14 of 16 · Summary · 2 minSection 14 of 16 · 2 min

Book contents

Section 14 of 16 · 2 min read

Gated Linear Units › SummaryOne section · Sections in this chapter14 / 16 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Gated Linear Units transform the standard feed-forward network by introducing multiplicative interactions through learned gates. Rather than applying a simple activation function, GLU computes two parallel projections and multiplies them together, with one pathway controlling how much of the other passes through.

Key takeaways:

  • The gating mechanism: GLU computes (xW)⊗σ(xV)(xW) \otimes \sigma(xV), where xx is the input, WW and VV are learned projection matrices, σ\sigma is the sigmoid function producing gate values in [0,1][0, 1], and ⊗\otimes denotes element-wise multiplication. This multiplicative interaction enables richer representations than additive transformations alone, capturing feature interactions that standard activations cannot express.

  • SwiGLU dominance: Modern LLMs predominantly use SwiGLU, defined as Swish(xW)⊗(xV)\text{Swish}(xW) \otimes (xV) where Swish(z)=z⋅σ(z)\text{Swish}(z) = z \cdot \sigma(z) is a self-gating activation that multiplies the input by its own sigmoid. The self-gating property of Swish, combined with the linear pathway, provides smooth gradients and unbounded positive outputs.

  • GeGLU alternative: GeGLU replaces Swish with GELU. This gives similar benefits with slightly different gradient characteristics. It's sometimes preferred for encoder models following BERT's GELU tradition.

  • Parameter trade-offs: GLU requires three weight matrices (WW, VV, W2W_2) instead of two, adding 50% more parameters for the same hidden dimension. To maintain parameter parity, models reduce dffd_{ff} to approximately 23\frac{2}{3} of the standard value. LLaMA uses dff=83×dmodeld_{ff} = \frac{8}{3} \times d_{\text{model}} instead of the standard 4×dmodel4 \times d_{\text{model}}.

  • Universal adoption: Since 2022, virtually every state-of-the-art LLM uses SwiGLU or a similar gated variant. LLaMA and Mistral use gated activations; PaLM and related models do as well. This shows consistent improvements in perplexity and later tasks.

  • Smoother activations: Unlike ReLU's hard sparsity, SwiGLU produces smoother activation distributions with preserved negative values. This improves gradient flow during training and allows the network to preserve graded feature information.

The next chapter assembles the components we've covered into complete transformer blocks. We'll see how the ordering and connections among residual and normalization components, plus attention and feed-forward components, create the architecture that underlies modern language models.