Barcelona Supercomputing Center releases open MrBERT text encoders

In short

How does a small model turn text into numbers for search?

Chatbots such as the ones most people know are decoders: they write text one word at a time. An encoder does the opposite job. It reads a whole passage at once and turns it into a list of numbers that captures its meaning. Those numbers drive the quiet machinery behind search boxes, spam filters, document sorting and the retrieval step that feeds a chatbot the right pages. Encoders are small enough to run cheaply over millions of documents, which is why companies and public bodies still rely on them.

The catch is language. Big multilingual models learn mostly from English web text, and languages such as Catalan get a sliver. MrBERT's own training data shows this: English is 67.4% of the 6.1 trillion tokens, Spanish 8.57% and Catalan 0.44%, about 26.7 billion tokens. Basque and Galician are about 0.11% and 0.08%.

BSC's answer is to train one broad model and then build narrower, cheaper ones from it.

Bar chart on a logarithmic scale of MrBERT's pre-training tokens per language: English at 67.44% far ahead, Spanish 8.57%, German 2.86%, French 2.83%, code 2.56%, falling to Catalan at 0.44% and below 0.1% for Galician, Maltese, Welsh, Irish and Occitan

How MrBERT's 6.1 trillion training tokens split by language. The scale is logarithmic: each step up the axis is ten times more text. Tamayo, Lacunza, Rivera-Hidalgo et al., arXiv 2602.21379 (2026), Fig. 1, CC BY 4.0.

What to notice: English alone is about two-thirds of the data; Catalan, the language BSC most wants to serve, is under half a percent.

Is MrBERT open source?

308M parameters in the base model (Hugging Face count: 307,884,672); 6.1T tokens used to pre-train it; 35 European languages, plus code; 8,192 tokens it can read at once

Every repository lists the Apache 2.0 licence and none asks for a sign-up form. In plain words (our reading): anyone may use, change, fine-tune and sell products built on these models, as long as the licence and copyright notice travel with them. The paper says the training used only openly licensed data, and its appendix lists the sources; the main model card says the full dataset list "will be published soon".

These are small files. At 16-bit precision, 308 million parameters come to roughly 0.6 GB (our arithmetic), so the models run on an ordinary laptop or a single modest graphics card.

How the family was built

The base model uses the ModernBERT design, an updated take on Google's BERT encoder that handles long passages efficiently. Training ran in three stages: 5.5 trillion tokens with short passages of 1,024 tokens, 500 billion tokens stretching it to long passages, and a final 100 billion tokens of higher-quality text at 8,192 tokens.

The language versions swap the base model's vocabulary of about 256,000 word pieces for a dedicated one of about 50,000, which is why they are half the size. MrBERT-es was trained further on 615 billion tokens, half Spanish and half English. MrBERT-ca started from the Spanish model rather than the base, because the shared Romance word forms helped, the paper says, and was trained on 47.4 billion tokens, half Catalan and half English.

The domain versions keep the full size and vocabulary and carry on training on specialist text: 24 billion tokens of biomedical text (84.7% English, 14.8% Spanish) and a legal set the paper puts at 9 billion tokens and the model card at 8 billion, about four-fifths English. MrBERT-science, trained on 3.6 billion tokens of scientific text, is on Hugging Face but not in the paper.

What BSC's tests show

All the scores below are from BSC's paper and model cards; we found no independent measurement.

The headline result is that the 150M language models beat their 308M parent on their own languages with half the parameters, which makes them cheaper to run.

The "Matryoshka" trick

The paper also tests Matryoshka training, named after Russian nesting dolls: the model is trained so that a slimmed-down part of it still works, letting users trade a little accuracy for speed. BSC slimmed the model by switching off some of its attention heads, the parts that decide which words to look at. Using only a quarter of them, the models ran up to 2.4 times faster, the paper reports, and the biomedical and legal versions kept most of their gains. The language versions coped worse, Catalan most of all: MrBERT-ca lost 3.06 points at that setting.

The Hugging Face model cards do not mention Matryoshka training, so we could not confirm which of the downloadable files, if any, can be slimmed this way. The speed and accuracy figures are from BSC's paper only.

Limits

The paper warns that the models should not replace expert judgement in medical or legal work, may carry biases from their training data, including under-representation of Latin American Spanish, and could be misused for mass document surveillance. BSC recommends human oversight for high-stakes uses. The work was paid for by Spain's Ministry for Digital Transformation with EU NextGenerationEU funds and by the Government of Catalonia's Aina project.

Terms in plain English

Sources

Sources

Related stories

More from AI in Europe

All stories from AI in Europe