Architecture / Blocks
verifiedFeed-Forward Network
Attention decides which tokens a position should look at. The feed-forward network is what the position does with what it found — a small two-layer network applied to each position independently. Attention moves information between positions; the feed-forward block thinks about it in place.
Two linear projections with a non-linearity between them, applied identically at every position: up-project from d sub model to d sub ff , activate, project back down. d sub ff is conventionally 4·d sub model , which puts roughly two thirds of a transformer's parameters in a block that never looks sideways. Because it is position-wise, it is embarrassingly parallel and the natural seam at which to introduce sparsity.
FFN(x) = W₂ · σ(W₁x + b₁) + b₂ with W₁ ∈ ℝ super d sub ff ×d sub model and W₂ ∈ ℝ super d sub model ×d sub ff . σ was ReLU originally and is now usually GeLU or a gated variant such as SwiGLU, which splits the up-projection in two and multiplies one half through a sigmoid gate. Gated variants use d sub ff ≈ (8/3)·d sub model to hold the parameter count fixed against the extra projection.
d-ff holds 33% of the budget; rest holds the remaining 67%.
Share of a transformer block's parameters held by the feed-forward layer, against the attention it sits beside. Drag d_ff up to the conventional 4× d_model and the feed-forward side takes two thirds of the block.
Attention costs about 4·d_model² in projections; the feed-forward layer costs about 2·d_model·d_ff. The split is d_ff / (d_ff + 2·d_model) — at d_ff = 4·d_model that is exactly 4/6, which is where the two-thirds figure comes from.
Reviewed by opendroid · 2026-08-01
- arXiv:1706.03762 — Attention Is All You Need
- arXiv:2002.05202 — GLU Variants Improve Transformer