EuroBERT: Scaling Multilingual Encoders for European Languages

Nicolas Boizard, Hippolyte Gisserot-Boukhlef, Duarte Miguel Alves, Andre Martins, Ayoub Hammal, Caio Corro, Celine Hudelot, Emmanuel Malherbe, Etienne Malaboeuf, Fanny Jourdan, Gabriel Hautreux, João Alves, Kevin El Haddad, Manuel Faysse, Maxime Peyrard, Nuno M Guerreiro, Patrick Fernandes, Ricardo Rei, Pierre Colombo

TL;DR

This paper introduces EuroBERT, a new family of multilingual encoder models designed for European and widely spoken global languages. By adapting recent architectural and training innovations from decoder-only models, EuroBERT achieves state-of-the-art performance across a range of tasks, including retrieval, classification, mathematics, and coding, while supporting significantly longer input sequences.

What Problem Does This Paper Address?

The field of Natural Language Processing (NLP) has seen a significant shift towards generative decoder-only models, leading to a relative stagnation in the development of bidirectional encoder models. While encoders are crucial for tasks requiring general-purpose vector representations (like retrieval and classification), they have largely been based on older architectures and training methodologies. This paper aims to bridge this gap by revisiting and refreshing the development of multilingual encoders, incorporating recent advancements to create more powerful and versatile models. The "curse of multilinguality," where performance degrades with more languages, is also a known challenge that the authors aim to mitigate through increased model capacity and careful data curation.

Methods

EuroBERT models are built upon a standard dense transformer architecture but incorporate several modern enhancements inspired by decoder models like Llama 3. These include:

  • Architecture: Removal of biases, grouped query attention, SwiGLU activation functions, RMSNorm layer normalization, and rotary position embeddings. Crucially, unlike decoders, causal masking is not applied.
  • Training Pipeline: A two-stage process involving pre-training and annealing.
  • Pre-training: Utilizes a Masked Language Modeling (MLM) objective with a 50% masking ratio. The dataset is a massive 5T-token multilingual corpus, including European and global languages, code, and mathematics.
  • Annealing: A second phase where the masking ratio is reduced to 10%, and the data distribution is adjusted to improve downstream performance. This phase also incorporates data filtering based on educational value and a curriculum learning approach.
  • Long Context: The models are trained to natively support sequences of up to 8,192 tokens, a significant increase over many previous encoder models.

Datasets

  • Training Data: A custom 5T-token multilingual corpus.
  • Pre-training: Primarily uses FineWeb (English) and CulturaX (multiple languages), augmented with EuroLLM parallel data and code/mathematics data from The Stack v2 and Proof-Pile-2.
  • Annealing: Data is filtered based on educational value, with a specific mix of languages, code, math, and parallel data.
  • Evaluation Datasets: A comprehensive suite covering various NLP tasks:
  • Retrieval: MIRACL, MLDR, Wikipedia, CC-News, CodeSearchNet, DupStackMath, MathFormula.
  • Sequence Classification: XNLI, PAWS-X, AmazonReviews, MassiveIntent, CodeDefect, CodeComplexity, MathShepherd.
  • Sequence Regression: WMT (quality estimation), SeaHorse (summarization).
  • Token Classification: NER (from XGLUE benchmark).

Key Insights and Ideas

  • Encoder Refresh: The paper demonstrates that recent architectural and training innovations from decoder models can be effectively transferred to bidirectional encoders, revitalizing this important model class.
  • Long Context is Key: Supporting sequences up to 8,192 tokens is shown to be crucial for maintaining performance, especially in tasks like retrieval and summarization, where longer documents are common.
  • Data Balancing Trade-offs: There's a delicate balance to strike:
  • Increasing parallel data improves both classification and retrieval.
  • Including code and math data boosts retrieval but can slightly degrade classification.
  • Filtering data by "educational value" can be detrimental for encoders, suggesting a need for broader data coverage that aligns with general-purpose tasks rather than assistant-like LLM tasks.
  • Masking Ratio Matters: A higher masking ratio (50%) is beneficial for pre-training, while a lower ratio (10%) during annealing improves classification accuracy.
  • Hyperparameter Sensitivity: Even large models can benefit significantly from more extensive hyperparameter searches, particularly in fine-tuning.

Key Results

  • State-of-the-Art Performance: EuroBERT models, especially the largest 2.1B parameter version, outperform existing alternatives on a wide range of multilingual tasks, including retrieval, classification, mathematics, and code.
  • Competitive with Larger Models: EuroBERT-2.1B competes closely with larger models like XLM-ROBERTa-3.5B, while EuroBERT-610M is competitive with XLM-ROBERTa-3.5B despite being five times smaller.
  • Efficiency Gains: EuroBERT-210M matches XLM-ROBERTa-560M performance while being less than half the size, and consistently outperforms other models of similar size.
  • Retrieval Strength: EuroBERT models show particularly strong performance on retrieval tasks, maintaining effectiveness even with longer context lengths, unlike some baselines that degrade.
  • Code and Math Specialization: EuroBERT models consistently surpass baselines on code and mathematics tasks.
  • Long Context Stability: EuroBERT maintains performance at longer context lengths (up to 8,192 tokens), whereas XLM-ROBERTa shows notable degradation.

Limitations and Future Work

  • Token Classification Gap: EuroBERT lags behind XLM-ROBERTa on the NER task. The authors hypothesize this might be due to XLM-ROBERTa's larger vocabulary, which could be beneficial for token classification. They note that increasing vocabulary size increases parameter count, especially for smaller models.
  • Data Filtering Mismatch: The authors observed that filtering data by educational value negatively impacted performance, suggesting a potential mismatch between the assumed quality filter and the actual needs of general-purpose encoder tasks. Future work could explore quality filters better tailored to encoders.
  • Cross-lingual Capabilities: While strong, the authors plan to explore other training signals to further enhance EuroBERT's cross-lingual capabilities, particularly for translation evaluation.
  • Hyperparameter Optimization: The paper highlights that even large models benefit from more extensive hyperparameter searches, suggesting that further tuning could unlock even more performance.

Summary updated

BibTeX
@inproceedings{boizard2025eurobert,
  author = {Nicolas Boizard and Hippolyte Gisserot-Boukhlef and Duarte Miguel Alves and Andre Martins and Ayoub Hammal and Caio Corro and CELINE HUDELOT and Emmanuel Malherbe and Etienne Malaboeuf and Fanny Jourdan and Gabriel Hautreux and João Alves and Kevin El Haddad and Manuel Faysse and Maxime Peyrard and Nuno M Guerreiro and Patrick Fernandes and Ricardo Rei and Pierre Colombo},
  title = {{EuroBERT: Scaling Multilingual Encoders for European Languages}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=jdOC24msVq},
}
Figure