Gated Linear Units › Key Parameters
Language AI HandbookAll chapters Gated Linear Units › Key ParametersOne section · Sections in this chapter15 / 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
When implementing or configuring GLU-based feed-forward networks:
-
d_model (input/output dimension): The embedding dimension, unchanged from standard FFNs. Must match the attention layer output for proper residual connections.
-
d_ff (hidden dimension): The dimension of the gated intermediate representation. For parameter parity with standard FFNs, use . LLaMA rounds this to the nearest multiple of 256 for hardware efficiency. Higher ratios (3.5x or 4x) trade parameters for expressiveness.
-
glu_variant: The choice of activation function for gating. SwiGLU () is the dominant choice. GeGLU uses GELU instead. ReGLU uses ReLU but is less common due to ReLU's sharp transitions.
-
use_bias: Whether to include bias terms. Modern architectures (LLaMA, Mistral, PaLM) typically omit biases entirely, reducing parameters and simplifying quantization. The impact on model quality is minimal.
-
multiple_of (LLaMA-specific): Round to a multiple of this value (typically 256) for GPU memory alignment. The formula used is:
where is the multiple_of value and denotes the ceiling function. For example, with and : the raw value is , and rounding up to the nearest multiple of 256 gives .