Abstract
While scaling laws for decoder-only large language models (LLMs) are well-established, encoder-only models—the workhorses of search, retrieval, and classification—have lacked a rigorous compute-optimality framework. This research provides the first comprehensive analysis of scaling laws for transformer encoders trained via Masked Language Modeling (MLM). Our findings reveal that current state-of-the-art (SOTA) encoders are significantly over-trained and that optimal encoder training requires 10 to 100 times more data per parameter than auto-regressive decoders. Leveraging these insights, we introduce OptiBERT, a model family that matches SOTA performance while utilizing 50x to 1000x less compute.
Introduction
In the landscape of Large Language Models, "Chinchilla" scaling laws provide a clear roadmap for balancing model size and dataset size for a given compute budget. However, encoder-only models like BERT, RoBERTa, and DeBERTa have historically relied on ad hoc architectural and training choices. As these models remain critical for high-precision tasks like RAG pipelines and search indexing, understanding their scaling behavior is essential for computational efficiency and environmental sustainability.
Methodology
To derive these scaling laws, the researchers conducted hundreds of controlled training runs on the FineWeb-edu corpus, a high-quality 1.3-trillion-token English dataset.
- Systematic Sweeps: The study employed Sobol sampling to evenly cover the parameter space, varying model size, data volume, batch size, and learning rates.
- Rigorous Compute Modeling: Moving beyond the standard $6ND$ approximation, the authors used a formula accounting for the non-negligible overhead of the attention mechanism at smaller scales.
- Loss Fitting: Performance was projected using parabolic and parametric loss fitting techniques to identify the "compute-optimal" frontier—the point where training loss is minimized for a specific compute expenditure.
Key Insights: The Data-Hungry Nature of Encoders
The study's most significant finding is that transformer encoders are far more "data-hungry" than their decoder counterparts. To reach compute optimality, an encoder should be trained on significantly more tokens relative to its parameter count compared to an LLM.
- Optimal Ratios: The data-to-model ratio for encoders is 10–100x higher than for decoders.
- The Masking Ratio: While the 15% masking standard has persisted since the original BERT paper, this research finds that as compute budgets scale, higher masking ratios (up to 80%) yield superior downstream performance.
- Over-training in SOTA: Analysis of recent models like ModernBERT and NeoBERT suggests they are over-trained by orders of magnitude, meaning they are either too large for their training data or use far more compute than necessary to achieve their results.
Results and the OptiBERT Family
By applying these new scaling recipes, the authors developed OptiBERT. The results demonstrate a dramatic shift in efficiency:
- Compute Savings: OptiBERT-239M, trained on 41B tokens, outperforms NeoBERT (trained on 2,100B tokens) on the Massive Text Embedding Benchmark (MTEB) while requiring 50x less compute.
- Extreme Efficiency: In some comparisons, OptiBERT achieved SOTA-level performance with 1000x less compute (measured in FLOPS).
- Training Velocity: While NeoBERT required approximately 6,000 H100 GPU hours, the equivalent OptiBERT reached the same performance threshold in just 64 H100 GPU hours.
Conclusion and Future Directions
This work establishes a new standard for training efficient encoder models. However, several avenues for future research remain. The current study focused on a fixed English dataset (FineWeb-edu) and a fixed context length (1024). Future investigations into multilingual scaling, varying width-to-depth ratios, and the impact of longer context windows will further refine our understanding of compute-optimal NLU.
Summary updated