Skip to content
← Notebook

RAG and embeddings

What chunk size should you use in a Spanish RAG? Measured with 3 embedding models

With 2048 tokens of context, 128-token chunks find the answer in 99.4% of 1190 Spanish questions; 1024-token chunks, in 91.7%. The model's input limit matters even more.

Date
Oct 20, 2026
Reading time
7 min
Result
99.4% vs 91.7% with 128 and 1024-token chunks (bge-m3) • MiniLM truncates 91.1% at 256 • 20% overlap: ≤ 2 points

Translated from the Spanish original. The code, data and READMEs on GitHub are in Spanish.

In a Spanish RAG, small chunks (128–256 tokens) retrieve more answers with the same context: with 2048 tokens for the LLM and bge-m3, 128-token chunks contain the answer for 99.4% of questions and 1024-token chunks, for 91.7%. Size matters even more when the chunk exceeds the embedding model’s limit: paraphrase-multilingual-MiniLM-L12-v2 truncates 91.1% of 256-token chunks and its recall@5 drops from 89.7% (128 tokens) to 80.5%. A 20% overlap moves the result by 2 points at most. Measured on 20 October 2026 on 1190 questions from XQuAD in Spanish.

RAG guides keep repeating “between 256 and 512 tokens with 10–20% overlap”, almost always with English corpora. We couldn’t find a measurement in Spanish with published code, so we made one.

Definitions

  • Chunk: each piece a document is split into before turning it into a vector (embedding) and storing it in the vector database. Here its size is measured in o200k_base tokens, the tokenizer of GPT-4o and GPT-5.
  • Overlap: part of the end of a chunk that is repeated at the start of the next, so an idea isn’t split in two.
  • recall@k: percentage of questions for which one of the k chunks most similar to the question contains the whole answer.
  • Recall within a context budget: the same, but instead of k chunks you take the best ones while they fit in 1024 or 2048 tokens, which is what you’d send to the LLM. It’s the fair comparison between sizes: five 1024-token chunks are five times more context than five 128-token ones.
  • Truncation: every embedding model has a maximum number of input tokens (max_seq_length). If the chunk exceeds it, the model only “reads” the beginning.

Hypotheses

  1. With the same context budget, small chunks retrieve more answers than large ones.
  2. Exceeding the embedding model’s maximum sinks recall, and in Spanish this happens sooner than it seems, because the model’s tokenizer uses more tokens than o200k_base for the same text.
  3. A 20% overlap helps little and increases the number of chunks to index.

Setup

  • Corpus: XQuAD in Spanish: 1190 questions with their exact answer, over 240 paragraphs from 48 professionally translated Wikipedia articles. Paragraphs are joined by article (47,870 tokens in total), so each article is a long document that has to be chunked.
  • Chunking: whole sentences packed up to 128, 256, 512 or 1024 tokens, with 0% and 20% overlap. A sentence is only split if it doesn’t fit on its own.
  • Embedding models (3), all multilingual and free to run locally: multilingual-e5-small (512-token maximum), paraphrase-multilingual-MiniLM-L12-v2 (128 maximum) and bge-m3 (8192 maximum, dense vector only).
  • Search: exact cosine similarity over all the chunks of the 48 articles at once, with no reranker or hybrid search.
  • Repetitions: 5 per configuration (24 configurations). Recall was identical in all 5; indexing time is given as a median. 95% bootstrap confidence interval over the questions.
  • Machine: Apple M1 Max laptop with 64 GB, macOS 26.6.2, Apple Silicon GPU (MPS), Python 3.12.4.

Results

Recall by chunk size (no overlap)

Model and size Chunks Truncated recall@1 recall@5 Recall with 1024 tokens Recall with 2048 tokens
bge-m3 · 128 469 0.0% 82.4% 97.1% 98.7% 99.4%
bge-m3 · 256 225 0.0% 82.1% 97.4% 97.0% 98.2%
bge-m3 · 512 117 0.0% 78.3% 96.1% 91.5% 95.8%
bge-m3 · 1024 66 0.0% 82.4% 96.1% 82.6% 91.7%
e5-small · 128 469 0.0% 81.3% 97.9% 98.7% 99.4%
e5-small · 256 225 0.0% 82.9% 97.6% 96.9% 98.4%
e5-small · 512 117 25.6% 83.8% 97.5% 94.4% 96.9%
e5-small · 1024 66 75.8% 77.6% 91.3% 77.8% 86.0%
MiniLM-L12 · 128 469 15.4% 63.3% 89.7% 93.7% 96.6%
MiniLM-L12 · 256 225 91.1% 52.5% 80.5% 77.8% 85.2%
MiniLM-L12 · 512 117 94.0% 49.2% 76.1% 64.1% 73.9%
MiniLM-L12 · 1024 66 92.4% 55.0% 77.2% 55.1% 67.5%

95% confidence intervals for the key figure (recall with 2048 tokens, bge-m3): 98.9–99.8% with 128-token chunks and 90.1–93.2% with 1024-token chunks. They don’t overlap.

Effect of a 20% overlap (bge-m3)

Size Chunks without overlap Chunks with overlap recall@5 without → with Recall with 2048 tokens without → with
128 469 494 97.1% → 97.5% 99.4% → 99.6%
256 225 249 97.4% → 98.5% 98.2% → 99.2%
512 117 129 96.1% → 96.6% 95.8% → 96.1%
1024 66 66 96.1% → 96.4% 91.7% → 92.4%

Across all three models and four sizes, overlap changes recall@5 by 2 points at most, and not always for the better: with MiniLM-L12 and 1024-token chunks it drops from 77.2% to 75.2%. It costs between 5.3% and 10.7% more chunks to index. Without overlap and with 128 or 256-token chunks, the whole answer fits in some chunk for 99.7% of questions: for the rest it’s split across two and no model can get it right.

Indexing time (median of 5 repetitions, 48 articles, no overlap)

Model 128 tokens 256 tokens 512 tokens 1024 tokens
multilingual-e5-small 1.216 s 1.153 s 1.116 s 0.67 s
paraphrase-multilingual-MiniLM-L12-v2 1.129 s 0.593 s 0.326 s 0.198 s
bge-m3 8.775 s 8.416 s 9.643 s 10.616 s

bge-m3 takes between 7.2 and 15.8 times as long as multilingual-e5-small and doesn’t retrieve more: with 128 or 256-token chunks, both fall within the same confidence interval. MiniLM-L12 is fast with large chunks because it only reads their first 128 tokens.

What it means

  • All three hypotheses hold. With the same context for the LLM, 128-token chunks beat 1024-token ones by 7.7 points with bge-m3 (2048-token budget) and by 16.1 points with a 1024-token budget.
  • Plain recall@5 is misleading. With bge-m3, recall@5 barely changes between 128 and 1024 tokens (97.1% and 96.1%), but five 1024-token chunks fill the context with five times more text. If you compare chunk sizes, compare them with the same token budget.
  • Measure the chunk with the embedding model’s tokenizer, not the LLM’s. A 512-token o200k_base chunk exceeds multilingual-e5-small’s 512 tokens in 25.6% of cases with this Spanish corpus. The model truncates without warning.
  • For a company with documents in Spanish: start with 128–256-token chunks, whole sentences and no overlap. A small model like multilingual-e5-small is enough for this kind of question and can run on any laptop.

When to use each option

  • 128–256-token chunks: specific fact questions (who, when, how much) over manuals, contracts or knowledge bases. That’s the case measured here.
  • Chunks of 512 tokens or more: only with a model that accepts them without truncating (bge-m3 or similar) and when the answer needs several consecutive paragraphs. We haven’t measured it with that kind of question.
  • Overlap: don’t turn it on by default; try it if your documents have very long sentences or lists that split badly.
  • paraphrase-multilingual-MiniLM-L12-v2: only with chunks of 128 tokens or fewer. Above that, it truncates almost every chunk.

Limitations

  • A single corpus: translated Wikipedia, with short, literal-answer questions. Company documents (PDFs, tables, jargon) and questions that require reasoning across several paragraphs may give a different optimal size.
  • The corpus is small (48 articles). With 1024-token chunks there are 66 chunks, and many articles fit in one or two. In a database of thousands of documents, competition between chunks is greater.
  • Strict hit: the whole answer has to be inside the chunk. We didn’t measure whether the LLM answers correctly with that context.
  • Exact dense search only: no BM25, hybrid search, reranker or approximate index (HNSW). bge-m3 was used with its dense vector only.
  • Three open embedding models. Paid API ones (OpenAI, Cohere, Voyage, Gemini) weren’t tested because they require a key.
  • Timings come from a single laptop with other apps open and the Apple Silicon GPU, in float32. They’re useful for comparing models with each other, not for sizing a server.

How to reproduce it

Code, environment and raw results (each question’s hit in each configuration and every indexing repetition): yeswelab-laboratorio/chunk-size-rag-espanol-embeddings on GitHub. No accounts or keys; it downloads the corpus and the models from Hugging Face.

Want to know which chunking and which embedding model work with your documents and your questions before building the RAG? Commission the experiment.

#sentence-transformers 6.1.0#bge-m3#multilingual-e5-small#XQuAD#Python 3.12