galician-reranker-me5-base
v0.1-rerank1. On a BM25 top 10 over DOG-RAG it ties BAAI/bge-reranker-v2-m3 (MRR@3 0.804 against 0.800) at half the size, and scores above gte-multilingual-reranker-base (0.795) and mxbai-rerank-base-v2 (0.760); none of these margins is significant. On top of a Galician dense retriever it does not help: with alejandro-rodriguez/galician-embedding-me5-base as the first stage, MRR drops from 0.833 to 0.816. Use it to rerank BM25 or a general multilingual retriever, not that model. On a second, smaller test set it falls behind bge-reranker-v2-m3 (BM25 top 10: 0.744 against 0.801), so the tie on DOG-RAG does not carry over to questions from another source. See Evaluation and Second test set.
A Galician cross-encoder reranker for official and administrative text, fine-tuned from intfloat/multilingual-e5-base (278M parameters). Given a question and a passage it returns a relevance score between 0 and 1. It is meant to reorder the top 10 results of a first-stage retriever such as BM25 before they go to a generator or a reader.
It was distilled from BAAI/bge-reranker-v2-m3 (568M) on Galician questions about the Diario Oficial de Galicia (DOG), two provincial bulletins and Parlamento de Galicia debates, plus legal and administrative pairs machine-translated from Spanish. On one L4 GPU it reranked the 9,170 test pairs in 28 s, against 77 s for the teacher.
Training and evaluation code, with the per-query results behind every number on this card: github.com/alejandrorodriguezalvarez884-dot/galician-retrieval.
Usage
pip install "sentence-transformers>=6.2"
from sentence_transformers import CrossEncoder
model = CrossEncoder("alejandro-rodriguez/galician-reranker-me5-base")
query = "Cal é o prazo para solicitar as axudas para o aluguer de vivenda?"
passages = [
"As solicitudes de axuda para o aluguer de vivenda poderán presentarse no prazo dun mes contado a partir do día seguinte ao da publicación desta resolución no Diario Oficial de Galicia.",
"O Consello da Xunta aprobou o proxecto de lei de orzamentos para o próximo exercicio.",
"As axudas para o aluguer de vivenda están destinadas a persoas cuxos ingresos non superen 2,5 veces o IPREM.",
]
for hit in model.rank(query, passages, return_documents=True):
print(f"{hit['score']:.3f} {hit['text'][:70]}")
# 0.998 As solicitudes de axuda para o aluguer de vivenda poderán presentarse
# 0.731 As axudas para o aluguer de vivenda están destinadas a persoas cuxos i
# 0.009 O Consello da Xunta aprobou o proxecto de lei de orzamentos para o pró
model.predict([(query, passage), ...]) returns the same scores: the model's logit through a sigmoid (set in config_sentence_transformers.json). No prefix or instruction is needed. Question and passage together are truncated at 512 tokens.
Evaluation
proxectonos/dog-rag: 502 questions (917 paraphrases, each one a query) about 122 DOG documents, generated by DeepSeek-V3 and reviewed by native speakers. The index is the public DOG 2025 text from proxectonos/corpus_dominio_legal_administrativo_tmp plus the 122 source documents: 36,318 chunks of 250 words with 50 words of overlap, from 2,661 documents. A first stage retrieves the top 10 chunks, the reranker reorders them and the top 3 are kept; P@3, R@3 and MRR at document level, as in nos-rag-eval. The paper indexed more than 12,000 documents, part of them not public yet, so absolute numbers here are higher than the paper's (BM25 + bge-reranker-v2-m3: 0.800 here, 0.752 in the paper).
On BM25 top 10:
| Reranker | Params | License | P@3 | R@3 | MRR |
|---|---|---|---|---|---|
| this model | 278M | MIT | 0.553 | 0.894 | 0.804 |
| BAAI/bge-reranker-v2-m3 | 568M | Apache-2.0 | 0.546 | 0.886 | 0.800 |
| Alibaba-NLP/gte-multilingual-reranker-base | 306M | Apache-2.0 | 0.536 | 0.896 | 0.795 |
| jinaai/jina-reranker-v3 (reference only) | 0.6B | CC BY-NC 4.0 | 0.541 | 0.881 | 0.789 |
| none (BM25 order) | 0.519 | 0.878 | 0.780 | ||
| mixedbread-ai/mxbai-rerank-base-v2 | 494M | Apache-2.0 | 0.522 | 0.858 | 0.760 |
| Qwen/Qwen3-Reranker-0.6B | 596M | Apache-2.0 | 0.515 | 0.865 | 0.751 |
On bge-m3 top 10:
| Reranker | P@3 | R@3 | MRR |
|---|---|---|---|
| BAAI/bge-reranker-v2-m3 | 0.534 | 0.899 | 0.807 |
| this model | 0.546 | 0.895 | 0.805 |
| jinaai/jina-reranker-v3 (reference only) | 0.499 | 0.864 | 0.772 |
| Qwen/Qwen3-Reranker-0.6B | 0.498 | 0.852 | 0.742 |
| none (bge-m3 order) | 0.500 | 0.846 | 0.740 |
This model and bge-reranker-v2-m3 were scored in the same job on one NVIDIA L4 (fp16). The other rerankers were scored with the same script on Kaggle T4s, where the BM25 first stage came out at 0.782 instead of 0.780 (tie order), so their rows are close to, but not exactly on, the same candidate lists.
Paired bootstrap over questions (paraphrases of a question resampled together, 10,000 samples), MRR difference and 95 % interval:
- against bge-reranker-v2-m3, BM25 top 10: +0.004 [−0.013, +0.021], p = 0.65;
- against bge-reranker-v2-m3, bge-m3 top 10: −0.002 [−0.019, +0.014], p = 0.80;
- against gte-multilingual-reranker-base, BM25 top 10: +0.009 [−0.010, +0.028], p = 0.34;
- against the BM25 order: +0.025 [+0.003, +0.046]; against the bge-m3 order: +0.065 [+0.042, +0.088].
After a Holm correction over all the reranker comparisons we report, the gain over the bge-m3 order holds; the gain over the BM25 order does not (adjusted p 0.28), and the ties stay ties.
MRR by DOG-RAG question type, BM25 top 10:
| Type | this model | bge-reranker-v2-m3 | BM25 order |
|---|---|---|---|
| sparsed_context | 0.657 | 0.592 | 0.626 |
| general | 0.846 | 0.841 | 0.802 |
| data_extracted | 0.776 | 0.800 | 0.798 |
| table | 0.917 | 0.955 | 0.904 |
It is behind the teacher on questions about tables and extracted figures, and ahead on questions whose answer is spread over the passage.
BM25 already has the right document in its top 10 for 97 % of the questions, so on DOG-RAG almost all of a reranker's gain comes from ordering.
Second test set: reviewed DOG 2025 questions
DOG-RAG's questions were written by an LLM, and so were this model's training questions. A second test set on the same index has 108 questions about 94 DOG 2025 documents that are not in DOG-RAG, drafted by another LLM (Claude Opus 5.5) and reviewed by a Galician linguist (97 kept as drafted, 11 edited). It was built to test the embedder; the reranker rows below were added after its analysis plan was fixed, so read them as exploratory.
| First stage | Reranker | P@3 | R@3 | MRR |
|---|---|---|---|---|
| BM25 | BAAI/bge-reranker-v2-m3 | 0.534 | 0.880 | 0.801 |
| BM25 | this model | 0.500 | 0.861 | 0.744 |
| BM25 | none | 0.438 | 0.796 | 0.698 |
| galician-embedding-me5-base | none | 0.506 | 0.880 | 0.815 |
| galician-embedding-me5-base | this model | 0.498 | 0.861 | 0.750 |
Paired bootstrap over questions (10,000 samples), MRR difference and 95 % interval:
- against bge-reranker-v2-m3, BM25 top 10: −0.057 [−0.100, −0.015], p = 0.007;
- against the BM25 order: +0.046 [−0.008, +0.100], p = 0.10;
- on top of galician-embedding-me5-base, against that model alone: −0.065 [−0.120, −0.011], p = 0.02.
On these questions it is clearly behind its teacher. The gap is on general questions (0.743 against 0.853, 50 questions) and questions whose answer is spread over the passage (0.714 against 0.845, 14); on questions about a concrete datum it is level or slightly ahead (0.767 against 0.742, 40). 108 questions can't say why. One possibility is that the distilled model fits the style of the training questions more closely than its teacher does.
On top of a Galician embedder
Same index and protocol, Apple M5 (fp32), first stage from galician-embedding-me5-base v0.2-mix:
| First stage | Reranker | MRR |
|---|---|---|
| galician-embedding-me5-base | none | 0.833 |
| galician-embedding-me5-base | this model | 0.816 |
| hybrid BM25 + galician-embedding-me5-base | this model | 0.816 |
| BM25 | this model | 0.803 |
The embedder already puts the right document first more often than this reranker does when it reorders the embedder's own list (−0.017, not significant). The same happens with bge-reranker-v2-m3 on top of the embedder's training run 4 (0.830 alone, 0.822 reranked).
Is the distillation needed?
The same groups, seed and schedule were trained again with the teacher's scores left out of the loss (alpha 1, one-hot target only), on a Kaggle T4. The teacher still chose which BM25 candidates to drop as probable answers, so this removes the soft labels, not the teacher.
| Dev MRR@10 | BM25 top 10 | bge-m3 top 10 | |
|---|---|---|---|
| this model (alpha 0.5) | 0.534 | 0.803 | 0.804 |
| no teacher scores (alpha 1) | 0.533 | 0.802 | 0.793 |
| bge-reranker-v2-m3 | 0.529 | 0.801 | 0.806 |
Read on the Kaggle job's candidate lists, which differ from the table above by BM25 tie order. Paired difference, no teacher minus this model: −0.001 [−0.014, +0.011] on BM25, −0.012 [−0.025, +0.002] on bge-m3. The hard negatives and the data carry the result; the soft labels add at most about a point on a dense first stage, which one run per setting can't confirm.
Training
The checkpoint is step 2,000 of 4,416 (one epoch), chosen on dev.
| Setting | Value |
|---|---|
| Loss | softmax cross-entropy over each question's group against a target that is 0.5 × one-hot(positive) + 0.5 × softmax(bge-reranker-v2-m3 logits) |
| Group | 1 positive and up to 7 negatives per question |
| Batch | 16 questions (4 per step, 4 accumulation steps) |
| Learning rate | 2e-5, linear decay, 10 % warmup |
| Steps | 4,416 (1 epoch), dev every 500; best kept (step 2,000) |
| Max sequence length | 512 tokens, question and passage together |
| Precision | fp32 weights, fp16 autocast |
| Seed | 0 |
| Compute | 128 min scoring the 845,714 training pairs with the teacher, 125 min of training, on one NVIDIA L4 |
Model selection used 454 synthetic questions over DOG 2024 (kept out of training), each searched with BM25 over its own passage plus 5,000 DOG 2024 distractors; the top 10 was reranked and scored with MRR@10. Dev MRR@10: BM25 order 0.479, bge-reranker-v2-m3 0.529, this model before training 0.175, at step 2,000 0.534. DOG-RAG was read once, for that checkpoint.
sentence-transformers 6.2.0, transformers 5.22.1, torch 2.15.0.
Training data
70,659 questions, each with one positive passage, from alejandro-rodriguez/galician-retrieval-pairs (the BM25 candidates below are not in that dataset; the code builds them from it). No DOG text from 2024 or later was used: DOG 2025 is the test index and DOG 2024 the dev set. Training questions sharing an 8-word sequence with a DOG-RAG question, and passages sharing a 20-word sequence with a DOG-RAG context, were removed.
| Source | Questions | License |
|---|---|---|
| SINAI/ALIA-es-legal-administrative-triplets (SINAI, Universidad de Jaén), query and positive translated to Galician with Nós MT | 29,832 | CC BY-SA 4.0 |
| DOG 1995 to 2023, from proxectonos/corpus_dominio_legal_administrativo_tmp, with synthetic questions | 24,968 | CC BY 4.0 |
| ParlaMint-ES-GA 5.0, Parlamento de Galicia debates 2015 to 2022, with synthetic questions | 7,209 | CC BY 4.0 |
| BOP A Coruña, with synthetic questions | 5,153 | CC BY 4.0 |
| BOP Pontevedra, with synthetic questions | 3,497 | CC BY 4.0 |
The synthetic questions were written by BSC-LT/salamandra-7b-instruct. Negatives come from two places: BAAI/bge-m3 hard negatives (ranks 10 to 50, never from the positive's own document; 200,054) and the BM25 top 8 over the pool of all training passages (264,334). bge-reranker-v2-m3 scored every pair; a BM25 candidate scoring within 0.1 of the positive was treated as a probable second answer and dropped (124,301). 1,081 questions left with no negative were dropped.
Limitations
- Two small test sets, both with LLM-written questions, as were most training questions. On DOG-RAG it ties bge-reranker-v2-m3; on the second set it is clearly behind it. Where model size and speed are not a constraint, bge-reranker-v2-m3 is the safer choice. It was not tested on news, FAQ or other Galician text.
- It lowers MRR when it reorders the top 10 of galician-embedding-me5-base (see above).
- Most training questions are synthetic, and the SINAI part is machine-translated from Spanish. Questions people actually type may be shorter or mix Spanish and Galician.
- It is weaker than bge-reranker-v2-m3 on table and extracted-figure questions (see above).
- Run-to-run spread: a first training run with the same data and settings, lost before upload, scored 0.800 on BM25 top 10 and 0.795 on bge-m3 top 10.
- The test index has 2,661 documents, not the 12,000+ of the paper, so absolute scores are optimistic.
- A cross-encoder runs the whole model on every candidate. Reranking 10 passages of 250 words takes about 0.66 s per question (median; 0.8 s at p90) on a laptop CPU (Apple M5, 4 threads, fp32) and 0.29 s on its GPU (MPS), against 13 ms to encode a question with the embedder.
- Official bulletins contain names of people (appointments, grants, sanctions). The model was trained on that text.
License and attribution
MIT, the license of multilingual-e5-base; the notice is in LICENSE. Credits:
- intfloat/multilingual-e5-base, Copyright (c) Microsoft Corporation, MIT. Wang et al. (2024), Multilingual E5 Text Embeddings: A Technical Report, arXiv:2402.05672.
- BAAI/bge-reranker-v2-m3, Apache-2.0, the distillation teacher and the filter for negatives; BAAI/bge-m3, MIT, for mining.
- SINAI/ALIA-es-legal-administrative-triplets, SINAI research group, Universidad de Jaén, CC BY-SA 4.0.
- proxectonos/Nos_MT-CT2-es-gl, MIT, Copyright (c) 2023 Proxecto Nós. Bardanca Outeirinho et al. (2024), PROPOR 2024.
- proxectonos/corpus_dominio_legal_administrativo_tmp, CC BY 4.0, and the publishers of the bulletins: Xunta de Galicia (DOG), Deputación da Coruña and Deputación de Pontevedra.
- ParlaMint-ES-GA 5.0, CC BY 4.0, Instituto da Lingua Galega (Universidade de Santiago de Compostela). Erjavec et al. (2024), Language Resources and Evaluation, doi:10.1007/s10579-024-09798-w.
- BSC-LT/salamandra-7b-instruct (Apache-2.0) for the synthetic questions.
- Evaluation: DOG-RAG (Apache-2.0) and the nos-rag-eval protocol (MIT) from Proxecto Nós. Rodríguez et al. (2026), DOG-RAG: A Galician Benchmark for Legal Retrieval-Augmented Generation, SEPLN 2026, CEUR-WS Vol-4301, Poster9. jina-reranker-v3 (CC BY-NC 4.0) appears only as an evaluation row; it was not used for any training data.