View all articles
EmbeddingsRAGOllamaSpanishBenchmarks

Best Local Embedding Model for Spanish: Measured Guide

JG
Jacobo González Jaspe
|

Reviewed:

Abstract illustration: glass columns of different heights; the tallest glows amber. Desde la spark
Illustration generated with AI on our own machine.
This article is also available in Spanish:El mejor modelo de embeddings local para español: guía

By the end of this guide you will know how to choose an embedding model for Spanish documents: what to read on a model card, what a public benchmark can and cannot tell you, and how to run the comparison on your own files. We did it for the three models Ollama users reach for. All three fit on a laptop: the largest loaded at 0.68 GB.

What you need

  • Ollama and about 2 GB of disk for the three models.
  • Python 3 with requests.
  • Your own questions, each with the document that answers it. Without them you are comparing models on someone else’s text.

What to look at before you download anything

1. The languages it was trained on. This is the first filter. A model trained on English still returns vectors for Spanish text; they are just worse, and nothing warns you.

2. What public benchmarks say, and what they leave out. MTEB is the standard public benchmark and its multilingual edition covers more than 500 tasks in over 250 languages. Use its leaderboard to build a shortlist. A leaderboard score is an average over many tasks and languages, on public datasets. It does not know your vocabulary, your document length or how your colleagues phrase a question. Our table below has the same limit for you: it is our text, not yours.

3. Dimensions. Each vector is stored as 32-bit numbers: 1,024 dimensions is 4 KB per chunk and 768 is 3 KB, before the index. That is arithmetic, not a measurement: a million chunks come to about 4.1 GB or 3.1 GB. More dimensions did not mean better retrieval in our test.

4. How much text fits in one call. A chunk longer than the model’s limit loses its end. The declared limit and the limit you get can differ; we found that with bge-m3 (below).

5. Whether it needs a prefix. Some models expect a label in front of questions and another in front of documents.

6. The licence. It decides whether you can ship the model inside a product.

The same six points for our three models, from each model card on 2026-11-15:

bge-m3nomic-embed-text (v1.5)embeddinggemma
Languagesmore than 100English100+
Declared input limit8,192 tokens8,192 on the card; 2K in Ollama’s build2K tokens
Dimensions1,024768, can be cut to 64768, can be cut to 512, 256 or 128
Prefixnonerequiredrecommended templates
LicenceMITApache 2.0Gemma Terms of Use
SourceBAAI cardNomic card, Ollama pageGoogle card

Two notes on that table. The Gemma terms are Google’s own agreement, not an open-source licence: they come with a prohibited-use policy that you must pass on if you redistribute the model. Read them before you bundle it. And “multilingual or Spanish-only” is a real choice: Spanish and bilingual models exist, such as jina-embeddings-v2-base-es (Spanish and English, Apache 2.0, 8,192 tokens by its card). We did not measure any of them. A multilingual model also covers the Catalan, Valencian or English documents that turn up in most Spanish offices; we did not test mixed-language folders either.

Step 1: pull the three models

bash
ollama pull bge-m3
ollama pull nomic-embed-text
ollama pull embeddinggemma
ollama list | grep -E "bge-m3|nomic|embeddinggemma"

If your Ollama says embeddinggemma does not exist, update it: its library page asks for v0.11.10 or later. We used 0.34.0.

Step 2: check what you are storing

bash
curl -s localhost:11434/api/embed -d '{"model": "bge-m3", "input": "¿Cuánto daba el Kit Digital?"}' \
  | python3 -c "import sys,json; print(len(json.load(sys.stdin)['embeddings'][0]))"
# 1024
ollama ps

The number is the dimension of each vector: 1024 for bge-m3, 768 for the other two. ollama ps shows the memory each model holds while loaded.

Step 3: give each model its prefix

Two of the three were trained to see a label in front of the text. bge-m3 takes the text as it is.

Python
PROMPTS = {
    "bge-m3": ("", ""),
    "nomic-embed-text": ("search_query: ", "search_document: "),
    "embeddinggemma": ("task: search result | query: ", "title: none | text: "),
}

The first of each pair goes in front of a question, the second in front of every chunk. Nomic’s card says the text “must include a task instruction prefix”. Skipping the prefixes breaks nothing; it costs points, as the table below shows.

Step 4: run the same questions through each model

Write a questions.json with questions in your colleagues’ words and the file that answers each one:

JSON
[{"q": "¿Cuánto me pagan por kilómetro si voy con mi coche?", "doc": "gastos"},
 {"q": "¿Dónde está el tóner?", "doc": "impresora"}]

Save this as compare_embeddings.py. It needs no vector database: it keeps the vectors in memory, which is fine for a few thousand chunks.

Python
import json, os, sys, pathlib, requests

OLLAMA = os.environ.get("OLLAMA", "http://localhost:11434")
PROMPTS = {                                   # (question prefix, document prefix), from each model card
    "bge-m3": ("", ""),
    "nomic-embed-text": ("search_query: ", "search_document: "),
    "embeddinggemma": ("task: search result | query: ", "title: none | text: "),
}

def embed(model, texts):
    out = []
    for i in range(0, len(texts), 32):
        r = requests.post(f"{OLLAMA}/api/embed", json={"model": model, "input": texts[i:i + 32],
                                                       "truncate": False, "keep_alive": 0})
        r.raise_for_status()
        out += r.json()["embeddings"]
    return out

def chunks(text, size=1000):
    out, cur, n = [], [], 0
    for w in text.split():
        if cur and n + len(w) >= size:
            out.append(" ".join(cur)); cur, n = [], 0
        cur.append(w); n += len(w) + 1
    return out + [" ".join(cur)]

folder, questions = pathlib.Path(sys.argv[1]), json.load(open(sys.argv[2], encoding="utf-8"))
parts = [(f.stem, c) for f in sorted(folder.glob("*.md")) for c in chunks(f.read_text(encoding="utf-8"))]
print(f"{len(parts)} chunks, {len(questions)} questions")
for model, (q_prefix, d_prefix) in PROMPTS.items():
    docs = embed(model, [d_prefix + c for _, c in parts])
    hit1 = hit5 = rr = 0
    for item, qv in zip(questions, embed(model, [q_prefix + x["q"] for x in questions])):
        scored = sorted(((sum(a * b for a, b in zip(qv, dv)), d) for dv, (d, _) in zip(docs, parts)), reverse=True)
        ranking = list(dict.fromkeys(d for _, d in scored))            # each document, at its best chunk
        rank = ranking.index(item["doc"]) + 1
        hit1 += rank == 1; hit5 += rank <= 5; rr += 1 / rank if rank <= 10 else 0
    n = len(questions)
    print(f"{model:18s} dim {len(docs[0]):4d}  hit@1 {hit1}/{n}  hit@5 {hit5}/{n}  MRR@10 {rr / n:.3f}")
bash
python3 compare_embeddings.py ./my-docs questions.json
# 6 fragmentos, 8 preguntas
# bge-m3             dim 1024  hit@1 8/8  hit@5 8/8  MRR@10 1.000
# nomic-embed-text   dim  768  hit@1 8/8  hit@5 8/8  MRR@10 1.000
# embeddinggemma     dim  768  hit@1 8/8  hit@5 8/8  MRR@10 1.000

That output is real, from 2026-11-15, and it is a warning. We ran the script (its Spanish edition, where only the printed words differ) on six short office documents and eight easy questions, and all three models got everything right. A set that small and that easy cannot rank anything. Write at least 20 questions, include the awkward ones, and expect to need more. The run is in rag-qdrant-walkthrough-2026-11-15.json.

The three numbers:

  • hit@1 and hit@5: questions whose correct document came first, or in the first five.
  • MRR: the average of 1 / rank of the first correct document, so it rewards putting it first.

The script uses the vectors as Ollama returns them, already normalised to length 1, so a plain dot product is the cosine similarity. To see what that score does, try our cosine similarity exercise. How to write the questions and how to tell a gain from noise is in Evaluate your RAG with 54 questions.

What we measured

Measured 2026-11-02. All three models on Ollama 0.34.0 on our second NVIDIA DGX Spark (GB10, 128 GB), one model loaded at a time. Qdrant 1.18.2 on the first Spark. Corpus: 50 of our published Spanish posts (501,917 characters), 60 questions written by hand with their gold documents, no gold answers. Raw file: rag-embeddings-es-2026-11-02.json. The command, from our internal repository:

bash
python3 scripts/bench/rag_embeddings_es.py --ollama http://<second-box>:11434 \
  --models bge-m3,nomic-embed-text,embeddinggemma --chunks 500,1000,2000 \
  --out docs/measurements/rag-embeddings-es-2026-11-02.json

Finding Spanish documents (chunks of 1,000 characters, 15 % overlap, model-card prefixes):

Modelhit@1hit@5MRR
bge-m378.3 %96.7 %0.862
nomic-embed-text78.3 %93.3 %0.841
embeddinggemma83.3 %100 %0.910

What each one costs (speed: all 610 chunks of the 1,000-character set in batches of 32, after a warm-up call; query time: median of the 60 questions, sent from the first box):

ModelParametersDimensionsFileLoaded (ollama ps)Declared contextChunks per secondOne query
bge-m3567 M1,0241.16 GB0.66 GB8,192 tokens58.928 ms
nomic-embed-text137 M7680.27 GB0.32 GB2,048 tokens133.17 ms
embeddinggemma308 M7680.62 GB0.68 GB2,048 tokens95.123 ms

MRR by chunk size (hit@5 in brackets):

Model500 characters1,000 characters2,000 characters
bge-m30.885 (96.7 %)0.862 (96.7 %)0.895 (100 %)
nomic-embed-text0.798 (91.7 %)0.841 (93.3 %)0.790 (88.3 %)
embeddinggemma0.884 (95.0 %)0.910 (100 %)0.913 (98.3 %)

Without the prefixes (1,000 characters): nomic-embed-text fell from 0.841 to 0.804 MRR and from 78.3 % to 73.3 % hit@1; embeddinggemma fell from 0.910 to 0.889 MRR and from 100 % to 96.7 % hit@5.

Three things the tables say.

The two multilingual models lead, and they are close. Across the three chunk sizes embeddinggemma averaged 0.902 MRR and bge-m3 0.880. We compared them question by question. On first place with 1,000-character chunks, embeddinggemma was right where bge-m3 was wrong 6 times, and the reverse happened 3 times: a sign test gives p = 0.51. Counting any change of position at that size, embeddinggemma ranked the correct document higher in 12 questions and lower in 3 (p = 0.035). At 500 characters it was 5 higher and 6 lower, and at 2,000 it was 6 and 5. One comparison out of six passing 0.05 is not a winner. The 95 % margin on a hit@5 near 97 % is about ±4.5 points.

nomic-embed-text is the English one. Its model card lists English as its language, and it trailed at every size, worst with long chunks. It was also the fastest by far: 133 chunks per second, 2.3 times bge-m3, with the smallest file.

Speed rarely decides at this size. Our whole corpus took 10.4 seconds with bge-m3 and 4.6 with nomic-embed-text. A query took 7 to 28 ms, including the trip between our two boxes. Indexing speed starts to matter at hundreds of thousands of chunks, or on a CPU.

A harder set, for scale. On 2026-11-15 we ran bge-m3 alone over the Spanish text of the EU AI Act: 761 chunks, 54 questions tied to exact passages. It put the right passage first in 41 of 54 (MRR 0.81). Split by wording, that was 17 of 18 for questions using the law’s own terms and 8 of 18 for questions in everyday words. A cross-encoder reranker over the top 25 raised first place to 44 of 54 (MRR 0.86), which a sign test cannot tell from noise (p = 0.51). We ran no other embedding model on that set. Raw file: reranker-es-legal-2026-11-15.json.

What changes when you switch model

Everything in the index. Vectors from two models live in different spaces, even when the dimension matches, so a question embedded with the new model cannot search chunks embedded with the old one.

  1. Re-embed every chunk with the new model and its prefixes. At our speeds, 610 chunks took 4.6 to 10.4 seconds, so for a small office this is minutes.
  2. Create a new collection. A vector store fixes the dimension when the collection is created. Sending 768-dimension vectors to our 1,024-dimension Qdrant collection returned Wrong input: Vector dimension error: expected dim: 1024, got 768.
  3. Embed questions with the same model. Ollama’s embeddings guide says to use one model for indexing and querying.
  4. Run your question file against both before you move anyone over, then switch. The alias switch that does it without downtime is in local RAG with Qdrant and bge-m3.

Changing the chunk size, the prefixes or the dimensions value means the same full re-index.

What the spec sheet won’t tell you

  • The context limit is a silent cut. Ollama’s /api/embed trims longer input by default instead of failing. We checked on 2026-11-02 with embeddinggemma: 5,000 words went through without complaint, and only "truncate": false returned “the input length exceeds the context length”. Our 2,000-character chunks came to about 600 tokens by the 7B model’s count, well inside.
  • bge-m3’s 8,192 tokens did not arrive by default. On 2026-11-15, with default options on Ollama 0.34.0, bge-m3 accepted 2,048 tokens and refused 2,049. Sending num_ctx: 8192 changed nothing. With "options": {"num_ctx": 8192, "num_batch": 8192} a 3,002-token input went through. We did not find out why, and we did not measure retrieval with chunks that long.
  • Ollama will shorten any model’s vectors. The embed reference has a dimensions field. We asked for 256 and all three models returned 256 numbers at length 1.0, bge-m3 included. embeddinggemma and nomic-embed-text were trained so their vectors can be cut this way, and their cards list the sizes. bge-m3’s card lists no such sizes. We did not measure retrieval at any reduced size.
  • Loaded size is not file size. ollama ps showed bge-m3 at 0.66 GB though the file is 1.16 GB. We report what Ollama says and did not dig further.
  • The questions decide the ranking. Our 60 were written by one person who had read the posts. With your documents and your colleagues’ wording, the order may change.

Other models we did not measure

All facts are from the linked pages on 2026-11-15. None of the three ran on our hardware.

ModelWhat its page saysIn Ollama’s library
qwen3-embedding”100+ Languages”; three sizes, the smallest a 639 MB fileyes
multilingual-e5-largeMIT, 1,024 dimensions, input cut at 512 tokens, needs query: and passage: prefixesnot checked
jina-embeddings-v2-base-esSpanish and English, Apache 2.0, 8,192 tokensnot checked

If one of them is on your shortlist, add it to PROMPTS in the script with the prefixes from its card and run your questions.

Verdict

  • Spanish documents, chunks of 500 to 2,000 characters: embeddinggemma or bge-m3. embeddinggemma had the best scores on our set with 768 dimensions and 0.68 GB loaded; check that the Gemma terms suit your use.
  • The licence must be plain MIT: bge-m3.
  • Chunks over 2,048 tokens: none of the three took them by default in our Ollama. bge-m3 can with the two options above; test it on your documents first.
  • Skip nomic-embed-text for Spanish unless indexing speed is your bottleneck; if you keep it, use its prefixes.

When not to do this

If you already index with one of these and your users find what they need, switching costs a full re-index and gains a few points at best. Measure first with 20 of your own questions. And if your documents are mostly tables or scanned PDFs, fix the text extraction before you compare models: no embedding model finds what the parser lost.

FAQ

Do I need a model trained only on Spanish? Not on our evidence. The two multilingual models found the right document in the top five for 95 % to 100 % of our Spanish questions. We did not measure a Spanish-only model, so we cannot say one would not do better.

Are more dimensions better? Not here. embeddinggemma’s 768-dimension vectors scored as well as bge-m3’s 1,024 on our set. Dimensions set the storage bill, not the quality.

Can I keep my old vectors and add new ones from another model? No. Scores between vectors from different models mean nothing. Re-index everything.

Does the leaderboard winner win on my documents? It may not. A leaderboard averages public datasets. Shortlist with it, then decide with your own questions.

How many questions do I need? Twenty catch a broken setup. With 60 we could not separate the two best models. The arithmetic of sample size is in our evaluation guide.

Does it run without a GPU? These models are small (0.32 to 0.68 GB loaded), but every speed in this post was measured on a GPU. We have no CPU numbers.

Next steps

Work with us

We size the model and the machine by measuring, not by guessing. If you want this comparison run on your own documents, book a free 15-minute call or see how we work in consulting.

Diagram
Share: LinkedIn X
Veredicto semanal

Get new guides before anyone else

Subscribe and we tell you when new guides, templates and workflows go up. One email a week, no spam.

Already published: 102 guides and 25 templates. All free, no signup.

Bonus: the local-AI starter pack PDF when you subscribe
Once a week No spam Unsubscribe anytime

See what you get