neuralmind's BERTimbau Beats Multilingual BERT for 1.5M Portuguese Developers
BERTimbau Large is a 335M parameter BERT tuned for Brazilian Portuguese, delivering state of the art on core NLP tasks and racking up over 1.5M downloads.
ProTakeaways
- BERTimbau Large is a 335M parameter BERT pretrained on Brazilian Portuguese, hosted on Hugging Face.
- Achieves state of the art on Portuguese NER, textual similarity, and textual entailment, beating multilingual BERT.
- Trained on the BrWaC corpus for 1M steps with whole word masking, initialized from English BERT weights.
- MIT licensed, free, drops into the standard transformers fill-mask pipeline in three lines.
- Over 1.5M monthly downloads and 64 published finetunes; ships in Base (110M) and Large (335M) sizes.
- Encoder only with 512 token context, so use it for embeddings and classification, not generation.
Portuguese speakers have long been second class citizens in the world of language models, forced to rely on multilingual BERTs that spread their capacity thinly across a hundred languages. BERTimbau Large, the Brazilian Portuguese model from neuralmind, is the community's answer to that gap, and it keeps climbing Hugging Face trending charts with over 1.5 million monthly downloads and a growing ecosystem of 64 published finetunes.
The checkpoint itself is a straightforward BERT-Large, but one purpose built for Portuguese from the ground up. It achieves state of the art results on three downstream tasks: named entity recognition, sentence textual similarity, and recognizing textual entailment. It ships under the MIT license, is free to use, and drops directly into the standard transformers pipeline.
What is actually inside the checkpoint
BERTimbau comes in two sizes that mirror the original English BERT release. The Large variant is drawing most of the current attention, though the Base version remains popular for latency sensitive workloads.
| Model | Architecture | Layers | Parameters |
|---|---|---|---|
| bert-base-portuguese-cased | BERT-Base | 12 | 110M |
| bert-large-portuguese-cased | BERT-Large | 24 | 335M |
The Large version has 24 layers, a hidden size of 1,024, and 16 attention heads, totaling roughly 335 million parameters. It uses English BERT weights as a starting point rather than random initialization, a deliberate transfer learning trick to bootstrap Portuguese representations faster.
How it was trained
Both cased variants were pretrained on BrWaC (Brazilian Web as Corpus), a large Portuguese corpus, for one million steps using whole word masking. When every subword token belonging to a masked word is hidden together, the model is pushed to learn more robust word level semantics than under the original per token masking scheme.
The Large model used a two stage schedule to save compute. The Base version trained for 1 million steps with a 512-token context window, while the Large ran for 900,000 steps at 128 tokens before expanding to 512 tokens for the final 100,000 steps. That short context warmup is the same trick DeepMind and Google used on the original BERT, and it materially cuts training cost since attention scales quadratically with sequence length.
Why it beat multilingual BERT
The original BERTimbau paper makes the case for language specific pretraining with hard numbers, reporting improvements over Multilingual BERT across every evaluated task. The gap comes down to two things: a vocabulary generated specifically from Portuguese text, and a training corpus that is not competing for capacity with 103 other languages.
The practical upshot is that a lot of Portuguese NLP work that previously required either mBERT or expensive translation into English can now be done natively, with better accuracy and faster inference.
Where it shines and where it stalls
- Strong at masked language modeling, sentence embeddings, named entity recognition, textual entailment, and semantic similarity in Brazilian Portuguese.
- Strong at serving as a base model for domain finetuning, evidenced by 64 downstream finetunes and appearances on the MTEB-BR embedding leaderboard.
- Weak at anything generative. This is an encoder only model, so text generation, chat, and instruction following are out of scope.
- Weak at long documents, given the 512-token context window and a pretraining corpus of only 2.6 billion tokens.
- Weak at European Portuguese nuance, since BrWaC is Brazilian focused.
Using it in five lines
The model plugs into the standard fill-mask pipeline. Here is the smallest possible sanity check:
from transformers import pipeline
pipe = pipeline("fill-mask", model="neuralmind/bert-large-portuguese-cased")
print(pipe("Tinha uma [MASK] no meio do caminho."))
The top prediction returns pedra with a score above 0.5, a nod to the famous Carlos Drummond de Andrade poem and a decent smoke test that the Portuguese semantics landed. For embeddings you swap in AutoModel and take the last hidden state, which comes out at shape (seq_len, 1024) for the Large variant.
Where it fits in your stack
BERTimbau competes with mBERT, XLM-R, and multilingual embedding models for the classical NLP jobs that still run most production text pipelines, rather than with GPT-4 or Llama for chat workloads. Concretely, reach for it when you need:
- NER for Brazilian legal, medical, or financial documents where entity types are language specific.
- Semantic search or deduplication over Portuguese content, either directly or by finetuning a sentence transformer on top.
- Text classification for moderation, intent detection, or sentiment where you have thousands rather than millions of labels.
- A cheap encoder to feed features into a larger downstream system, since 335M parameters runs comfortably on a single GPU.
The GitHub repository includes the full training recipe, tokenizer artifacts, and finetuning scripts for the NER task if you want to reproduce or extend the work. Given how thin the Portuguese model landscape still is compared to English, BERTimbau remains one of the few battle tested defaults, and its continued download velocity suggests the community agrees.