Sentence Similarity
sentence-transformers
Safetensors
Galician
xlm-roberta
feature-extraction
dense-retrieval
legal
administrative
text-embeddings-inference

galician-embedding-me5-base

v0.2-mix. On DOG-RAG (Galician official bulletin) it scores 0.832 MRR@3 on its own, above BM25 (0.782) and BAAI/bge-m3 (0.740), and level with bge-m3 followed by bge-reranker-v2-m3 (0.807), a pipeline of two models about four times its size. It is weaker than bge-m3 on short passages: 4–6 points behind on news paragraphs and about 8 points behind on WebFAQ answers. On a second, smaller DOG 2025 test set it again beats BM25 but cannot be told apart from bge-m3 or the two-model pipeline. See Evaluation, Second test set and Other Galician tasks.

A Galician sentence embedding model for retrieval over official and administrative text, fine-tuned from intfloat/multilingual-e5-base (278M parameters). It was trained on Galician question and passage pairs: synthetic questions over the Diario Oficial de Galicia (DOG), two provincial bulletins and Parlamento de Galicia debates, plus legal and administrative pairs machine-translated from Spanish.

This version is a weight interpolation: every tensor is 0.9 times the fine-tuned model (training run 4) plus 0.1 times multilingual-e5-base, with no further training (WiSE-FT, Wortsman et al. 2022). Moving a little back toward the base recovers some of what fine-tuning on long administrative passages lost, at no cost on DOG-RAG.

Unlike the base model, it takes no query: or passage: prefix. Queries and passages are encoded as they are, so it drops into a pipeline that calls plain encode(), such as nos-rag-eval.

Training, evaluation and analysis code, with the per-query results behind every number on this card: github.com/alejandrorodriguezalvarez884-dot/galician-retrieval. A companion reranker trained on the same data: alejandro-rodriguez/galician-reranker-me5-base.

Versions

One commit per version, each tagged. Load a given version with revision="v0.2-mix".

Version Weights Date Dev MRR@10 DOG-RAG MRR@3 alone Hybrid with BM25
v0.2-mix 0.9 × run 4 + 0.1 × multilingual-e5-base 2026-11-05 0.450 0.832 0.827
run 5 (not uploaded) run 4 recipe plus short passages and WebFAQ training rows 2026-11-05 0.467 0.836 0.833
run 4 (not uploaded) run 3 recipe, 2 epochs 2026-11-05 0.460 0.830 0.834
v0.1-run3 run 3, 1 epoch 2026-11-05 0.430 0.808 0.825
BM25 0.782
Alibaba-NLP/gte-multilingual-base 0.778
BAAI/bge-m3 0.740 0.796
multilingual-e5-base, untrained (with prefixes) 0.724
multilingual-e5-base, untrained (no prefixes) 0.338 0.701

"Hybrid with BM25" is reciprocal rank fusion (k = 60) of BM25's and the model's top 100 chunks, top 10 kept; it adds nothing over the model alone. Dev is 454 synthetic questions over DOG 2024, used for model selection only; it compares runs, not models. Run 4, this mix and run 5 can't be told apart on DOG-RAG (see Training noise); the mix was kept for its scores on news and WebFAQ, where run 5 is no longer zero-shot.

Usage

pip install "sentence-transformers>=6.2"
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("alejandro-rodriguez/galician-embedding-me5-base")

query = "Cal é o prazo para solicitar as axudas para o aluguer de vivenda?"
passages = [
    "As solicitudes 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.",
]
q = model.encode([query])
p = model.encode(passages)
print(model.similarity(q, p))
# tensor([[0.3542, 0.0630]])

On a laptop CPU (Apple M5, 4 threads, fp32) a query takes about 13 ms to encode and passages go through at about 18 per second (250-word chunks, batch 32); on the same machine's GPU (MPS), 8 ms and 40 per second. Peak memory under 3 GB.

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. Top 10 retrieved, top 3 kept, metrics 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.

Retriever Reranker P@3 R@3 MRR nDCG@10
this model, v0.2-mix none 0.586 0.923 0.832 0.889
run 4 none 0.587 0.925 0.830 0.887
hybrid BM25 + run 4 none 0.581 0.917 0.834 0.890
v0.1-run3 none 0.566 0.901 0.808 0.874
BAAI/bge-m3 BAAI/bge-reranker-v2-m3 0.534 0.899 0.807
BM25 BAAI/bge-reranker-v2-m3 0.546 0.886 0.800
BM25 none 0.519 0.880 0.782 0.851
Alibaba-NLP/gte-multilingual-base none 0.540 0.886 0.778
Snowflake/snowflake-arctic-embed-l-v2.0 (prompted) none 0.525 0.868 0.777 0.840
google/embeddinggemma-2 (prompted) none 0.502 0.857 0.753 0.823
BAAI/bge-m3 none 0.500 0.847 0.740 0.820

Paired bootstrap over questions (paraphrases resampled together, 10,000 samples), MRR difference and 95 % interval:

  • against bge-m3: +0.092 [+0.067, +0.116];
  • against BM25: +0.050 [+0.024, +0.076];
  • against bge-m3 + bge-reranker-v2-m3: +0.025 [+0.002, +0.049], p = 0.03;
  • against run 4: +0.002 [−0.004, +0.007], no difference.

The gains over bge-m3 and BM25 hold after a Holm correction across all the comparisons we report. The +2.5 points over bge-m3 + bge-reranker-v2-m3 point the same way in every training seed (below) but are not significant after the correction (adjusted p 0.17–0.19): read it as a tie with a two-model pipeline.

With a reranker

Adding a reranker on top of this model does not help. On the same candidate lists (Apple M5, fp32, where this model alone reads 0.833):

Pipeline MRR
this model alone 0.833
hybrid BM25 + this model 0.827
this model + galician-reranker-me5-base 0.816
run 4 + bge-reranker-v2-m3 (run 4 alone: 0.830) 0.822

The reranker costs about 660 ms per question on a laptop CPU for the top 10, against 13 ms to encode the question. Use this model alone.

Where it gains and where it fails

Questions that mention a procedure code, a decree number or a file number (79 of 917) are where dense models usually lose to BM25. This model scores 0.791 MRR on them, against 0.698 for BM25 and 0.565 for bge-m3.

Most errors are sibling documents. When the top-ranked document is wrong, 85–90 % of the time (for every system tested) it comes from the same issuer as the right one: the same call in another year, the same template for another grant. A random document shares the issuer 6 % of the time. Questions that name the year, the call or the beneficiary group explicitly retrieve better.

Second test set: reviewed DOG 2025 questions

DOG-RAG's questions were written by an LLM, and so were this model's training questions. To check that it does more than match one generator's style, we built a second test set on the same index: 108 questions about 94 DOG 2025 documents that are not in DOG-RAG, drafted by another LLM (Claude Opus 5.5) and reviewed one by one by a Galician linguist. The review was light: 97 questions stayed as drafted and 11 were edited. No question shares 8 or more consecutive words with its document. The comparisons and their correction were fixed in writing before any system was run on it.

Retriever Reranker P@3 R@3 MRR
this model, v0.2-mix none 0.506 0.880 0.815
run 5 none 0.528 0.861 0.806
BAAI/bge-m3 BAAI/bge-reranker-v2-m3 0.535 0.898 0.804
BAAI/bge-m3 none 0.491 0.870 0.789
BM25 none 0.438 0.796 0.698

Paired bootstrap over questions (10,000 samples), Holm correction over the six planned comparisons:

  • against BM25: +0.117 [+0.043, +0.193], adjusted p 0.012;
  • against bge-m3: +0.026 [−0.039, +0.093], not significant;
  • against bge-m3 + bge-reranker-v2-m3: +0.011 [−0.042, +0.063], not significant.

It ranks first again, and the gain over BM25 holds. With 108 questions the three dense systems can't be separated. BM25 does much worse here than on DOG-RAG (0.698 against 0.780) and bge-m3 better (0.789 against 0.740): these questions copy little wording from their documents. As on DOG-RAG, this model's edge is on questions about a concrete datum (an amount, a date, a deadline: 0.804 against 0.679 for bge-m3, 40 questions); on general questions bge-m3 + bge-reranker-v2-m3 is ahead (0.853 against 0.807, 50 questions). Scoring the unrevised drafts gives the same numbers for this model.

Training noise

Run 4's recipe was trained again with seeds 1 and 2 (the seed changes data order, dropout and which 30,000 SINAI rows are drawn), each then mixed 0.9 with the base as this model was.

DOG-RAG MRR news doc news paragraph PAWS-gl AP WebFAQ nDCG@10
run 4, seeds 0 / 1 / 2 0.830 / 0.830 / 0.831 0.961 / 0.946 / 0.946 0.816 / 0.809 / 0.810 0.549 / 0.549 / 0.546 0.762 / 0.765 / 0.752
mix 0.9, seeds 0 / 1 / 2 0.832 / 0.828 / 0.832 0.965 / 0.956 / 0.961 0.829 / 0.816 / 0.825 0.547 / 0.546 / 0.546 0.768 / 0.776 / 0.765

This model is seed 0. Against bge-m3 + bge-reranker-v2-m3 the three mixes are +0.025, +0.021 and +0.025.

Other Galician tasks

  • nos-rag-news (proxectonos/nos-rag-news): 114 questions about 30 news articles, searched over 2,324 passages (the test articles plus 2,202 distractor passages from the Praza sample in nos-rag-eval). MRR at document level and at paragraph level.
  • PAWS-gl (proxectonos/PAWS-gl): 2,000 test sentence pairs; average precision of the cosine similarity against the paraphrase label.
  • WebFAQ (PaDaS-Lab/webfaq-v2, Galician): 309 questions from 24 sites held out by a hash of the site name, searched over 569 answers; nDCG@10. No WebFAQ data was used to train this model.
Model news MRR (document) news MRR (paragraph) PAWS-gl AP WebFAQ nDCG@10
BAAI/bge-m3 0.969 0.871 0.552 0.847
this model, v0.2-mix 0.965 0.829 0.547 0.768
run 4 0.961 0.816 0.549 0.762
multilingual-e5-base, untrained (no prefixes) 0.947 0.807 0.495 0.794
multilingual-e5-base, untrained (with prefixes) 0.877 0.733 0.484 0.765
BM25 0.809 0.652 0.659

This model against bge-m3, paired bootstrap (questions resampled for news and WebFAQ, 10,000 samples; pairs for PAWS-gl, 2,000 samples), difference and 95 % interval:

  • news, document MRR: −0.004 [−0.035, +0.022], a tie;
  • news, paragraph MRR: −0.042 [−0.088, +0.003]. The seed 1 and seed 2 mixes are −0.056 and −0.047. The drop is there in every model and seed we trained; with 114 questions no single comparison survives the Holm correction, so treat it as a consistent drop of 4–6 points;
  • PAWS-gl, average precision: −0.006 [−0.021, +0.010], a tie;
  • WebFAQ, nDCG@10: −0.078 [−0.102, −0.055], below the untrained base as well. This one holds after the correction.

Choosing the mixing weight

Candidate weights were 1.0 (run 4), 0.9, 0.8, 0.7, 0.6, 0.5 and 0.0 (the base). The rule, fixed before any result was read: take the smallest weight whose dev MRR@10 is within 0.01 of run 4's, and read DOG-RAG once for that weight only. It picked 0.9 (0.8 was 0.015 below). The other tasks were scored for every weight to show the trade-off, after the choice was made:

Weight of run 4 Dev MRR@10 news MRR (document) news MRR (paragraph) PAWS-gl AP WebFAQ nDCG@10
1.0 (run 4) 0.460 0.961 0.816 0.549 0.762
0.9 (this model) 0.450 0.965 0.829 0.547 0.768
0.8 0.444 0.965 0.832 0.545 0.772
0.7 0.438 0.968 0.833 0.542 0.779
0.6 0.431 0.974 0.844 0.539 0.787
0.5 0.415 0.978 0.845 0.531 0.792
0.0 (multilingual-e5-base) 0.338 0.947 0.807 0.495 0.794

Lower weights do better on news and WebFAQ and worse on DOG dev. They were not read on DOG-RAG.

Training

Run 4, the fine-tuned model:

Setting Value
Loss CachedMultipleNegativesRankingLoss, in-batch negatives plus one mined hard negative
Batch 128 per GPU on 2 GPUs, gathered across devices; mini-batch 16
Learning rate 5e-5, linear decay, 5 % warmup
Steps 560 (2 epochs), dev evaluation every 50 steps; best checkpoint kept (step 450)
Max sequence length 512 tokens
Pooling mean, L2-normalized, cosine similarity, no prefixes
Precision fp32 weights, fp16 autocast
Seed 0
Compute 92 min of training on 2 x NVIDIA T4 (Kaggle)

Then the interpolation: for every tensor of run 4, 0.9 * run4 + 0.1 * multilingual-e5-base, saved in fp32. The BERT pooler was dropped before training because mean pooling never uses it. The interpolated file still has pooler.dense.* tensors (re-created when run 4 was loaded for mixing, so they are not the base model's); they don't affect the sentence embeddings, so ignore pooler_output if you load the weights with plain transformers. sentence-transformers 6.2.0, transformers 5.22.1.

Training data

71,740 pairs, released as alejandro-rodriguez/galician-retrieval-pairs. 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 Pairs License
SINAI/ALIA-es-legal-administrative-triplets (SINAI, Universidad de Jaén), query and positive translated to Galician with Nós MT 30,000 CC BY-SA 4.0
DOG 1995 to 2023, from proxectonos/corpus_dominio_legal_administrativo_tmp, with synthetic questions 25,457 CC BY 4.0
ParlaMint-ES-GA 5.0, Parlamento de Galicia debates 2015 to 2022, with synthetic questions 7,363 CC BY 4.0
BOP A Coruña, with synthetic questions 5,323 CC BY 4.0
BOP Pontevedra, with synthetic questions 3,597 CC BY 4.0

The synthetic questions were written by BSC-LT/salamandra-7b-instruct. Hard negatives were mined with BAAI/bge-m3 (ranks 10 to 50, never from the positive's own document) and filtered with BAAI/bge-reranker-v2-m3. 11,508 pairs that the bge-m3 filter had dropped were brought back because BM25 ranked their passage in its top 10 and the reranker scored it as an answer; their negatives come from BM25.

The translated Spanish part is not what drives the result. The same recipe without the 30,000 SINAI pairs (41,740 rows, 54 % of the training time) scores 0.827 on DOG-RAG against run 4's 0.830 (−0.003 [−0.018, +0.012]), and moves news, PAWS-gl and WebFAQ by less than the seed spread. One seed only, so: no measurable contribution, not none.

Limitations

  • Short passages: on FAQ answers and single news paragraphs it is behind bge-m3, and on WebFAQ behind the untrained base too. The training passages are 250-word bulletin chunks. For short-answer collections, bge-m3 is the safer choice.
  • 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.
  • DOG-RAG is small, and its questions were also written by an LLM. A model trained on synthetic questions can fit that style. The second test set changes the generator but was only lightly reviewed, and it is too small to separate this model from bge-m3.
  • DOG-RAG test was read for every candidate: runs 1 to 5, this mix, the two extra seeds and the no-SINAI run. Each checkpoint was chosen on dev, but later recipes were designed after seeing earlier test scores.
  • The test index has 2,661 documents, not the 12,000+ of the paper, so absolute scores are optimistic.
  • Passages longer than 512 tokens are truncated.
  • Official bulletins contain names of people (appointments, grants, sanctions). The model was trained on that text and can retrieve it.

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.
  • 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; BAAI/bge-m3 (MIT) and BAAI/bge-reranker-v2-m3 (Apache-2.0) for mining.
  • Weight interpolation: Wortsman et al. (2022), Robust fine-tuning of zero-shot models, CVPR 2022, arXiv:2109.01903.
  • Evaluation: DOG-RAG (Apache-2.0), nos-rag-news, PAWS-gl and the nos-rag-eval protocol (MIT) from Proxecto Nós; WebFAQ (Dinzinger et al., PaDaS-Lab, University of Passau). Rodríguez et al. (2026), DOG-RAG: A Galician Benchmark for Legal Retrieval-Augmented Generation, SEPLN 2026, CEUR-WS Vol-4301, Poster9.
Downloads last month
31
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for alejandro-rodriguez/galician-embedding-me5-base

Finetuned
(200)
this model

Datasets used to train alejandro-rodriguez/galician-embedding-me5-base

Papers for alejandro-rodriguez/galician-embedding-me5-base