Introduction
Training Large Language Models (LLMs) efficiently requires leveraging massive GPU clusters, which is primarily achieved through large-batch training. However, scaling batch sizes often introduces a "generalization gap," where models exhibit poor performance on unseen data compared to those trained with smaller batches. While optimizers like LAMB were designed to mitigate this using layer-wise trust ratios based on $l_2$-norms, they often fail to stabilize the specific instabilities inherent in Transformer architectures. This paper introduces MERIT (Maximum-normalized Element-wise Ratio), an optimizer designed to stabilize attention layers and enable extreme batch size scaling without sacrificing model quality.
The Problem: Attention Logit Explosion
The primary obstacle in large-batch training for Transformers is the instability of the attention mechanism. The authors identify a phenomenon termed Max Attention Logit explosion. During training with standard optimizers like AdamW, the values within the attention mechanism (logits) can spike uncontrollably. This leads to "attention entropy collapse," where the model's attention becomes overly focused on a few specific tokens, ignoring the broader context and degrading the model's ability to generalize.
Standard solutions like LAMB use $l_2$-norm trust ratios to normalize updates. However, the $l_2$-norm averages the energy across all weights in a layer, which is often too coarse to suppress the specific "peaks" in weight values that drive logit spikes. Consequently, a more granular and targeted approach is required to maintain stability at scale.
Methodology: The MERIT Optimizer
MERIT introduces three key innovations to address the limitations of existing large-batch optimizers:
- Max-Norm Trust Ratios ($l_\infty$): Unlike LAMB's use of the $l_2$-norm, MERIT utilizes the max-norm ($l_\infty$). By focusing on the maximum absolute values within weight matrices, MERIT directly targets the primary drivers of inflated attention logits, providing a more effective "speed limit" for the weights most likely to cause training instability.
- Element-wise Granularity: Rather than calculating a single ratio for an entire layer, MERIT operates at a finer structural level. It calculates trust ratios for each row and column of a weight matrix and assigns an element-wise ratio based on the maximum of its corresponding row-wise and column-wise trust. This approach respects the 2D structure of neural network weights and effectively manages "outlier dimensions" that frequently occur in Transformers.
- Element-wise Clipping: To prevent erratic updates in any single dimension, MERIT implements a clipping mechanism. This limits the maximum update magnitude to 1 across all dimensions, a strategy inspired by the success of "Sign Momentum" optimizers.
Experimental Setup
The researchers evaluated MERIT across several standard language modeling configurations:
- Models: GPT-2 (Small, Medium, and Large) and Llama-style models (130M and 350M parameters).
- Datasets: Pre-training was conducted on OpenWebText and the C4 (Colossal Clean Crawled Corpus).
- Evaluation: Performance was measured using zero-shot benchmarks including LAMBADA, WikiText, and the SuperGLUE suite.
Key Insights and Results
Scaling and Stability
MERIT demonstrates remarkable scaling capabilities. For GPT-2 Medium, it enabled a batch size of 6,000 without any performance degradation relative to the standard batch size of 480. This represents a significant leap in potential parallelism for distributed training.
Generalization and Landscape Flattening
Across all GPT-2 variants, MERIT consistently achieved lower validation loss than AdamW, LAMB, Lion, and Sophia-G when utilizing large batches. Hessian analysis revealed that MERIT leads models toward "flatter" regions of the loss landscape. In deep learning theory, flatter minima are strongly correlated with better generalization, as the model becomes less sensitive to small perturbations in input data.
Performance and Efficiency
Models trained with MERIT outperformed those trained with AdamW and LAMB on downstream tasks like WikiText and LAMBADA, confirming that the stability gains translate into improved zero-shot intelligence. Furthermore, despite the additional calculations for row and column ratios, MERIT is highly efficient, adding less than 1% computational overhead in terms of TFLOPS compared to AdamW.
Conclusion and Future Work
MERIT provides a robust framework for large-batch training by addressing the root causes of attention instability through max-norm, element-wise trust ratios. While the current study validated the optimizer on models up to 770M parameters (GPT-2 Large), future research is needed to confirm these benefits at the multi-billion parameter scale (e.g., 7B to 70B+). Additionally, exploring MERIT's efficacy in other domains, such as computer vision or reinforcement learning, remains an open area for investigation.
Summary updated