EuroBERT: Scaling Multilingual Encoders for European Languages

Nicolas Boizard, Hippolyte Gisserot-Boukhlef, Duarte M. Alves, André F. T. Martins, Ayoub Hammal, Caio Corro, Céline Hudelot, Emmanuel Malherbe, Etienne Malaboeuf, Fanny Jourdan, Gabriel Hautreux, João Alves, Kevin El Haddad, Manuel Faysse, Maxime Peyrard, Nuno Miguel Guerreiro, Patrick Fernandes, Ricardo Rei, Pierre Colombo · DOI

TL;DR

EuroBERT revitalizes the classic bidirectional encoder (like BERT) by upgrading it with modern architectural and training innovations originally developed for generative LLMs. The result is a family of open-source multilingual encoders (up to 2.1B parameters) that natively support 8k context windows and outperform older staples like XLM-RoBERTa, particularly in retrieval, mathematics, and coding tasks.

What Problem Does This Paper Address?

In recent years, the NLP community has been laser-focused on scaling generative, decoder-only models (like GPT-4 or Llama). Meanwhile, bidirectional encoders—which are still the workhorses for tasks like document retrieval, sentence classification, and regression—have been largely left behind. Practitioners are often forced to rely on older models like XLM-RoBERTa, missing out on years of advancements in network architecture, data curation, and training recipes. The authors of this paper address this gap by applying the latest LLM scaling laws and techniques to a bidirectional encoder.

Methods

The authors introduce a refreshed recipe for training encoders, resulting in the EuroBERT family (210M, 610M, and 2.1B parameters).

  • Modernized Architecture: They adopt a Llama 3-style architecture but keep it bidirectional. This includes stripping out biases and adding Grouped Query Attention (GQA), SwiGLU activations, RMSNorm, and Rotary Position Embeddings (RoPE).
  • Two-Phase Training:
    • Pre-training: Models are trained on 4.8 trillion tokens using a Masked Language Modeling (MLM) objective with a high masking ratio (50%) and a 2,048-token context window.
  • Annealing: The final 200 billion tokens use a curriculum where the masking ratio drops to 10%, the context window expands to 8,192 tokens, and the data mix is rebalanced to prioritize higher-quality sources.
  • Variable-Length Cropping: To teach the model to handle long contexts effectively during annealing, they randomly crop fixed-length documents into variable-length sequences.

Datasets

Training Data: The models were trained on a massive 5-trillion-token corpus covering 15 languages (a mix of European and widely spoken global languages).

  • Text: FineWeb (English) and CulturaX (Multilingual).
  • Parallel Data: EuroLLM translation pairs to improve cross-lingual transfer.
  • Domain-Specific: The Stack v2 (38 programming languages) and Proof-Pile-2 (mathematics).

Evaluation Data: EuroBERT was benchmarked across 18 tasks spanning retrieval (MIRACL, MLDR), classification (XNLI, PAWS-X), code and math (CodeSearchNet, MathShepherd), and regression/token classification (WMT, SeaHorse, NER).

Key Insights and Ideas

  • The "Educational Filter" Trap: Unlike generative LLMs, filtering training data for high "educational value" actually degrades encoder performance. Encoders benefit from a broader, messier coverage of textual data for general-purpose vector representations.
  • The Code/Math Trade-off: Injecting code and math data boosts multilingual document retrieval but comes at a slight cost to standard sentence classification accuracy.
  • Masking Ratios Should Evolve: A 50% masking ratio is ideal for initial pre-training, but dropping to 10% during annealing improves classification performance.
  • Instructions Hurt Encoders: Adding instruction data during the annealing phase actively harmed model performance, unlike the standard practice for decoders.
  • Variable Lengths for Long Context: Training on random, variable-length sentence crops during annealing prevents performance degradation when the context window is stretched to 8,192 tokens.

Key Results

EuroBERT demonstrates significant improvements over legacy encoders across multiple domains. Notably, the EuroBERT-610M model matches the performance of the much larger XLM-RoBERTa-3.5B across several multilingual tasks while being five times smaller.

EuroBERT performance across MIRACL, XNLI, CodeSearchNet, and MathShepherd benchmarks compared to model size.
  • State-of-the-Art Performance: The largest model, EuroBERT-2.1B, ranks 1st on 10 out of the 18 evaluated tasks.
  • Domain Dominance: All EuroBERT models consistently outperform existing baselines (like mGTE and XLM-R) on code and mathematics benchmarks.
  • Long-Context Resilience: On long-document retrieval tasks, EuroBERT maintains its accuracy as document length increases, whereas older models like XLM-RoBERTa suffer notable degradation.

Limitations and Future Work

  • Token Classification Lag: EuroBERT slightly underperforms XLM-RoBERTa on Named Entity Recognition (NER) due to tokenizer "fertility" (splitting words into more sub-tokens). Future iterations may increase vocabulary size to address this.
  • Encoder-Specific Data Filters: The authors plan to develop quality filters specifically tailored to the needs of bidirectional representation learning rather than relying on LLM-style filters.
  • Balancing Trade-offs: Future work will investigate strategies to better balance the observed trade-offs between retrieval capabilities and classification accuracy.

Summary updated

BibTeX
@inproceedings{boizard2025eurobert,
  author = {Nicolas Boizard and Hippolyte Gisserot-Boukhlef and Duarte M. Alves and André F. T. Martins and Ayoub Hammal and Caio Corro and Céline 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 Miguel 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