Feed-Forward Network

Also known as: FFN, MLP Block

In Transformers, the feed-forward network (position-wise MLP) follows attention in each block. It expands each token’s hidden state to a wider intermediate size, applies a nonlinearity (ReLU, GeLU, SwiGLU, …), then projects back to model dimension.

Why it matters

Much of an LLM’s parameter count lives in FFNs—often more than attention projections. Capacity for factual and syntactic “storage” is frequently attributed to these layers. MoE variants sparsely activate expert FFNs per token to scale parameters without full dense compute.

Design knobs

  • Intermediate multiplier (e.g., $4\times$ or gated variants)
  • Activation choice and whether weights are shared across positions (they are—same FFN per position)
  • LoRA / adapters often target FFN projections for domain adaptation

FFNs are applied independently per position; all cross-token mixing happens in attention.

← Back to AI Glossary