Instructions to use tardellirs/brazembed-pt-br-retrieval with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use tardellirs/brazembed-pt-br-retrieval with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("tardellirs/brazembed-pt-br-retrieval") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
brazembed-pt-br-retrieval
brazembed-pt-br-retrieval is the retrieval and reranking expert of BrazEmbed-PT-BR: a sentence-embedding model based on BERTimbau (the Brazilian BERT, 110M parameters, pretrained by NeuralMind on brWaC), specialised for semantic search, RAG retrieval, reranking.
- 768-dimensional embeddings, mean pooling, max 128 tokens, no instruction prefix. License: MIT.
- For one general-purpose model, use tardellirs/brazembed-pt-br (the merge of the four experts; MTEB-BR 57.5, on the benchmark's Pareto frontier).
Usage
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("tardellirs/brazembed-pt-br-retrieval")
emb = model.encode(["O Brasil é um país tropical da América do Sul."], normalize_embeddings=True)
Or route each task type to its expert with route.py:
| Expert | Use for |
|---|---|
| brazembed-pt-br-clfclu | classification, clustering |
| brazembed-pt-br-pairclf | pair classification / NLI |
| brazembed-pt-br-sts | semantic similarity |
| brazembed-pt-br-retrieval | retrieval, reranking |
How it was trained
- Stage 1: BERTimbau was fully fine-tuned with symmetric in-batch InfoNCE on 3,633 Gemini-generated Portuguese query–passage pairs (medical, legal, encyclopedic and web domains), turning the masked language model into an embedding model. All four experts start from this same Stage-1 encoder.
- This expert: A uniform weight-soup of three LoRA adapters (r=16) trained with InfoNCE plus mined hard negatives on mMARCO-pt (400k pairs), SQuAD-pt_BR (78k), Ulysses-RFCorpus (4.2k, oversampled) and 5,851 synthetic legal QA pairs (federal-law passages with Gemini-generated queries). mMARCO-pt was checked against the Quati judged pool (0 of 8.8M passages overlap) and SQuAD-pt_BR/Ulysses against FaQuAD, JurisTCU, BRTaxQA and Quati (0 overlap).
The LoRA weights are merged into the full model, so it loads as a plain SentenceTransformer. Training ran on single
A10G GPUs in June 2026.
Evaluation
On the 16-task development version of the MTEB-BR benchmark, used while building the models: Retrieval 0.515 · Reranking 0.601 (category averages). Development iterated against that benchmark without a held-out split, so these numbers carry some selection optimism. The current MTEB-BR (por, v1) leaderboard (21 tasks) evaluates the merged single model, brazembed-pt-br.
Citation
@article{stekel2026mtebbr,
title = {MTEB-BR: A Text Embedding Benchmark for Brazilian Portuguese},
author = {Stekel, Tardelli Ronan Coelho},
journal = {arXiv preprint arXiv:2607.04581},
year = {2026}
}
- Downloads last month
- 132
Model tree for tardellirs/brazembed-pt-br-retrieval
Base model
neuralmind/bert-base-portuguese-cased