Place RMSNorm immediately after every linear layer to stabilize activation scales at O(sqrt(d)) and reduce Hessian spectral norm. Enables 3-10x larger learning rates and faster convergence without architectural changes; improves loss by 0.08 on 7B models.
Place RMSNorm immediately after every linear layer to stabilize activation scales at O(sqrt(d)) and reduce Hessian spectral norm. Enables 3-10x larger learning rates and faster convergence without architectural changes; improves loss by 0.08 on 7B models.
SimpleGPT: Linear-Layer Normalization for Training Stability
Standard Transformer architectures place LayerNorm only before attention and MLPs, allowing activation scales to drift during training. SimpleGPT proposes a minimal change: insert RMSNorm immediately after every linear transformation (Q/K/V projections, MLPs, output projections). This simple shift dramatically improves optimization geometry, enabling much larger learning rates and faster convergence.
The key insight is that normalization right after linear projections stabilizes the activation scale that linear layers output, preventing the representation drift that limits learning rate. This is grounded in second-order optimization: the Hessian spectral norm directly limits maximum learning rate, and SimpleNorm reduces this bound significantly.
Core Concept
SimpleNorm applies a uniform pattern across the entire model:
Standard Transformer: Linear → Activation → (Attention/MLP)
SimpleGPT: Linear → RMSNorm → Activation → (Attention/MLP)
This seemingly small change has outsized impact because:
Stabilized activation scale: RMSNorm forces activations to remain at O(√d), preventing explosion or vanishing
Reduced Hessian curvature: Normalization smooths the loss landscape, reducing spectral norm of Hessian
Weight-scale invariance: Unlike unnormalized layers where curvature scales with ||W||₂², normalized layers maintain consistent curvature regardless of weight magnitude
Architecture Overview
Linear projections (Q, K, V in attention; feed-forward up/down): Apply RMSNorm immediately after
Output projections (attention out, MLP out): Apply RMSNorm after
RMSNorm placement: Before activation functions (ReLU, GELU, etc.)
Hyperparameter scaling: Increase learning rate 3-10× based on model size
"""
Root Mean Square Layer Normalization.
Args:
hidden_dim: Dimension to normalize over
eps: Numerical stability epsilon
"""
super
self
self
def
forward
self, x: torch.Tensor
"""
Apply RMSNorm: x / sqrt(E[x^2] + eps) * weight
Args:
x: Input tensor of any shape with last dim = hidden_dim
Returns:
Normalized tensor, same shape as input
"""
# Compute RMS over last dimension
2
1
True
self
# Normalize and scale
return
self
Step 2: Modify Linear Layers with Post-Linear Normalization
Create a composite module combining linear projection and immediate normalization.
Key results: 0.08 point loss improvement on 7B Llama3 models; 3-10× larger learning rates enabled; validated across nanoGPT (120M), Llama2 (7B), and Llama3 (8B). Minimal training overhead with torch.compile. No architectural changes required.