Feed-forward block and gated FFN

Transformer components · component · 2020 · any domain

What it is

The per-token MLP that holds most parameters, usually widened 4x and gated in modern models.

When to use it

Capacity vs compute decisions, and the layer MoE replaces with an expert bank.

Caveats

The feed-forward layers hold roughly two thirds of a transformer's parameters, so they dominate model size. Gated variants such as SwiGLU add a third weight matrix, so the hidden width is reduced to keep the parameter count equal.

Key ideas

  • A two-layer MLP applied to each token position independently
  • Expands to a wider hidden size (typically about 4x) and projects back
  • Gated versions (SwiGLU, GeGLU) multiply two projections together

Related architectures

Original paper

GLU Variants Improve Transformer (2020, arXiv)

Lessons that cover it

Browse all 198 architectures

The architecture landscape, in one place.

Two things get called “ML architecture”: the classical statistical model families, and the neural network wirings. Both are here, tagged by what they are and what data they eat.

Start from your problem

Architectures

0 shortlisted