gated linear layers
**Gated linear layers** is the **module pattern where a linear transform is modulated by a learned gate branch before output** - it provides fine-grained control over feature flow and supports richer nonlinear behavior than plain linear blocks.
**What Is Gated linear layers?**
- **Definition**: Two projection branches where one branch generates features and the other generates gate values.
- **Combination Rule**: Output is produced by elementwise multiplication between feature activations and gate activations.
- **Activation Options**: Gate branch can use sigmoid, GELU, Swish, or related nonlinear functions.
- **Transformer Usage**: Common inside modern feed-forward blocks and specialized conditioning modules.
**Why Gated linear layers Matters**
- **Selective Pass-Through**: Gates suppress irrelevant features and amplify useful context signals.
- **Expressive Capacity**: Multiplicative interactions improve function class compared with additive-only blocks.
- **Training Stability**: Controlled feature scaling can improve optimization in deep stacks.
- **Model Efficiency**: Better information filtering can raise quality at similar parameter counts.
- **Design Flexibility**: Gate formulation can be adapted for dense and sparse architectures.
**How It Is Used in Practice**
- **Block Integration**: Replace standard activation MLP with gated modules in target model layers.
- **Kernel Fusion**: Optimize projection, bias, activation, and gating multiply in efficient epilogues.
- **Ablation Analysis**: Measure convergence speed and final accuracy against non-gated baselines.
Gated linear layers are **a practical architecture upgrade for transformer feed-forward modeling** - they improve feature routing while preserving implementation simplicity.