Skip to content

Embedding models: how to pick one for retrieval

An embedding model turns text into vectors that retrieval compares by angle. What to weigh when picking one, why models can't share an index, and how to test.

Published
Reading time
16 min read

In short

  • An embedding model maps text, and in multimodal models images, audio, or video, to a fixed-length vector. Retrieval embeds the query with the same model and returns the stored vectors with the highest cosine similarity, the cosine of the angle between two vectors.
  • MTEB retrieval scores are a shortlist, not a decision. The maintainers report that the top models reach their scores partly by training on benchmark tasks, and the benchmark's corpora are not yours.
  • Dimensions set storage and search cost. A million 3,072-dimension float vectors take about 12.3 GB, and Matryoshka-trained models let you keep the first 256 to 1,024 numbers and re-normalize, at a measurable loss you should test.
  • Vectors from two different models cannot share an index, so changing models means re-embedding the corpus. The exceptions are model families that the vendor states share one space, such as Voyage's 4 series and Cohere's Embed 5 Pro and Fast.
  • Pick by running 50 to 100 of your own labeled queries through two or three candidates and comparing recall at k, with the same chunks, the same task prefixes, and the dimensions you would deploy.

An embedding model is a neural network that turns an input, usually a passage of text, into a fixed-length vector of numbers, placed so that inputs with similar meaning point in similar directions. Retrieval systems embed every document chunk once, embed each query at request time with the same model, and return the chunks whose vectors are closest to the query's. The choice of embedding model decides what "closest" means for your corpus, and changing it later means re-embedding everything.

This guide covers what an embedding is, how retrieval scores it, and what to weigh when picking a model: benchmark scores and their limits, dimensions and Matryoshka truncation, input length, languages, modalities, hosted versus open weights, and cost. It ends with a test you can run on your own queries. Model specifications below were checked against each vendor's documentation in November 2026.

What an embedding is

An embedding is a list of numbers, typically 256 to 4,096 of them, that represents one input as a point in a high-dimensional space. OpenAI's text-embedding-3-small returns 1,536 numbers per input by default, and Voyage's voyage-4 returns 1,024. No single number means anything on its own. What carries meaning is the direction of the whole vector relative to others from the same model.

The model learns those directions in training, typically on pairs of texts that should match, such as a question and the passage that answers it. After training, "how do I rotate an API key" and "steps to replace a credential" land close together, even though they share no words. That is the property keyword search lacks, and the reason chunking strategies and embedding choice together decide what a RAG system can find.

Embeddings are lossy summaries. One vector for a 2,000-token chunk averages everything in it, and the details that change an answer, such as negation, numbers, exact identifiers, and who is asking, are the ones most likely to blur. Semantic caching runs into the same weakness from the other side, with prompts that sit close together and need opposite answers.

How retrieval uses cosine similarity

Retrieval ranks stored vectors by cosine similarity to the query vector: the cosine of the angle between them, which is 1 when they point the same way and falls as they diverge. Length plays no part, so a long chunk and a short one are compared only by direction.

EMBED WITH ONE MODELVECTOR SPACE, DRAWN IN 2DQueryAT REQUEST TIMEDocument chunksINDEXED IN ADVANCEEmbedding modelTEXT IN, FIXED-LENGTH VECTOR OUTθQUERYTOP 2WIDE ANGLE · LOW SCORE
The query and the chunks go through the same model. Retrieval compares directions: the two chunks at the smallest angle to the query score highest. Real embeddings have hundreds or thousands of dimensions; two are drawn here.

When vectors are normalized to length 1, cosine similarity is just their dot product, and Euclidean distance produces the same ranking. OpenAI's embeddings guide states that its vectors are normalized to length 1 and that the choice of distance function typically doesn't matter much. Normalize once at write time and use the dot product, which is what most vector indexes compute fastest.

search.py
import numpy as np
 
def normalize(v: np.ndarray) -> np.ndarray:
    return v / np.linalg.norm(v, axis=-1, keepdims=True)
 
def top_k(query: np.ndarray, docs: np.ndarray, k: int = 5):
    # On unit vectors the dot product is the cosine similarity.
    scores = normalize(docs) @ normalize(query)
    best = np.argsort(-scores)[:k]
    return best, scores[best]

A production index does not compare the query with every vector. It uses an approximate nearest-neighbor structure such as HNSW, which trades a small amount of recall for search time that grows far more slowly than the corpus. The embedding model sets the ceiling on what that index can find, and the index settings decide how close to that ceiling a search gets.

Single vectors also have a structural limit. A 2025 paper, On the Theoretical Limitations of Embedding-Based Retrieval, argues that the number of distinct top-k result sets an embedding can produce is bounded by its dimension, and built a simple dataset, LIMIT, on which strong models still perform poorly. In practice this is one more reason to pair dense retrieval with keyword search and a reranker instead of expecting a better embedding model to fix every miss.

What to weigh when picking an embedding model

Seven properties narrow the field before any test: retrieval quality on comparable data, dimensions, maximum input length, languages, modalities, deployment, and cost. The table lists the current specifications of a cross-section of widely used models, as published by each vendor in November 2026.

ModelWeightsMax inputDefault dimsOther dimsInputs
OpenAI text-embedding-3-smallHosted API8,192 tokens1,536Any, via dimensionsText
OpenAI text-embedding-3-largeHosted API8,192 tokens3,072Any, via dimensionsText
Google gemini-embedding-001Hosted API2,048 tokens3,072128 to 3,072Text
Google gemini-embedding-2Hosted API8,192 tokens3,072128 to 3,072Text, image, audio, video, PDF
Voyage voyage-4-large, voyage-4, voyage-4-liteHosted API32,000 tokens1,024256, 512, 2,048Text
Voyage voyage-4-nanoOpen weights32,000 tokens1,024256, 512, 2,048Text
Cohere embed-v5.0-pro, embed-v5.0-fastHosted API128,000 tokens2,048256, 512, 768, 1,024, 1,536Text, images, mixed pages
Qwen Qwen3-Embedding-8BApache 2.032,000 tokens4,09632 to 4,096Text
BAAI bge-m3MIT8,192 tokens1,024NoneText, plus sparse and multi-vector output

The sections below take each property in turn. Leaderboard positions are left out on purpose, because they change every few weeks.

MTEB retrieval scores, and what they leave out

The MTEB leaderboard is the standard public comparison of embedding models, and its retrieval scores are a reasonable way to build a shortlist. The current multilingual version, MMTEB, covers more than 500 evaluation tasks across over 250 languages. Read the retrieval column, not the overall average, because the average mixes in classification, clustering, and other tasks a retriever never performs.

Four limits apply to any score you read there:

  • Training overlap. The maintainers' 2025 paper, Maintaining MTEB, reports that the highest-ranking models achieve their scores partly by training on benchmark tasks. The leaderboard tracks a zero-shot score, the share of benchmark datasets a model was not trained on, as a coarse measure of this. Check it, and treat models with undisclosed training data with caution.
  • Your corpus is not the benchmark's. Public retrieval sets are mostly web text, Wikipedia, and question-answer pairs. Contracts, support tickets, product codes, and internal jargon behave differently.
  • Small gaps are noise for your use. OpenAI lists MTEB averages of 62.3% for text-embedding-3-small and 64.6% for text-embedding-3-large, a 2.3-point gap at 6.5 times the price. Whether those points show up on your queries is something only a test on your data answers.
  • Scores are measured at one configuration. A model scored at full dimensions with its recommended prefixes may score differently at the truncated size and prompt format you actually deploy.

Dimensions, storage, and Matryoshka truncation

Dimensions set the size of the index and the cost of every comparison. A float32 vector takes 4 bytes per dimension, so one million chunks at 3,072 dimensions take about 12.3 GB before index overhead, and at 1,024 dimensions about 4.1 GB. Most approximate indexes need to sit in memory to be fast, so this number feeds straight into the size of the machines you pay for.

Index limits can also decide for you. pgvector indexes vector columns of up to 2,000 dimensions with HNSW or IVFFlat, halfvec up to 4,000, and stores each vector in 4 bytes per dimension plus 8. A 3,072-dimension model needs halfvec or a shorter output before pgvector will index it.

Matryoshka embeddings are what make shorter outputs practical. Matryoshka Representation Learning, a 2022 paper, trains a model so that the first part of each vector is a usable embedding by itself. The paper reports embeddings up to 14 times smaller at the same accuracy on ImageNet-1K classification. Cohere describes its Embed 5 outputs as Matryoshka embeddings and Qwen3 Embedding supports output sizes from 32 to 4,096, and the ranges of output sizes in the table come from the same idea.

There are two ways to get a shorter vector, and both end in a normalization step:

  • Ask the API. OpenAI's dimensions, Google's output_dimensionality, Voyage's output_dimension, and Cohere's output dimension options return a shorter vector directly. OpenAI's guide reports that on MTEB, text-embedding-3-large shortened to 256 dimensions still outperforms a full 1,536-dimension text-embedding-ada-002 embedding.
  • Truncate yourself. Keep the first n numbers and normalize again. OpenAI and Google both state that a vector you cut yourself must be re-normalized. Google's gemini-embedding-2 normalizes truncated outputs for you, while gemini-embedding-001 requires you to normalize anything below 3,072.
truncate.py
def truncate(v: np.ndarray, dims: int) -> np.ndarray:
    # Valid only for Matryoshka-trained models. Re-normalize after cutting.
    return normalize(v[..., :dims])

Truncating a model that was not trained this way discards information at random, so check the model card first. Quantization stacks with truncation: Voyage's 4 series and Cohere's Embed 5 models return int8 or binary vectors, and a binary vector stores one bit per dimension, 32 times smaller than float32. A common pattern is to search a compact index and rescore the top few hundred candidates with full vectors.

Maximum input tokens and chunking

The input limit caps how long a chunk can be before the API truncates it or returns an error. Limits now range from 2,048 tokens for gemini-embedding-001 to 128,000 for Cohere's Embed 5 models, so most documents fit in one call on most models.

Fitting is not the same as retrieving well. A single vector for a long document averages every topic in it, and chunks of a few hundred tokens usually retrieve better, as the chunking strategies guide covers with published tests. A long input limit pays off in two places: it lets chunks follow document structure without being cut, and it enables techniques such as late chunking, where a long-context model embeds the whole document and pools per-chunk vectors.

Check how each API handles overlong input. Some truncate silently, which drops the end of a chunk from its vector without any error in your logs. Count tokens with the model's own tokenizer when you chunk, not with another model's.

Query and document prefixes

Many retrieval models expect a short instruction or input type that marks a text as a query or a document, and leaving it out lowers quality. Voyage's input_type of query or document prepends a fixed prompt, such as "Represent the query for retrieving supporting documents:". Google's gemini-embedding-001 takes a task_type such as RETRIEVAL_QUERY or RETRIEVAL_DOCUMENT, while gemini-embedding-2 takes a prefix in the text itself instead. The Qwen3 Embedding model card recommends a one-sentence task instruction on the query side, and reports a drop of about 1% to 5% in most retrieval scenarios without one.

Treat the prefix as part of the model's configuration. Store it with the index, apply it in both the indexing job and the query path, and include it in any benchmark you run. A query path that drops the prefix after a refactor degrades retrieval without raising an error.

Languages and domains

A model trained mostly on English text can still return vectors for other languages, but its ranking quality there may be much worse. If your users write in more than one language, check two things: that the model card names your languages, and that retrieval works across them, such as a Spanish question finding an English document.

bge-m3, Qwen3 Embedding, and Cohere's Embed 5 models each state support for more than 100 languages. MMTEB publishes per-language and per-domain results, which are a better shortlist filter for a non-English corpus than the English retrieval average.

Domain matters in the same way. Voyage publishes models trained for code (voyage-code-4), finance (voyage-finance-2), and law (voyage-law-2). Whether a domain model beats a strong general model on your documents is a question for the test at the end of this guide, not something to assume from the name.

Multimodal embeddings

Multimodal embeddings place more than one kind of input in a single vector space, so a text query can retrieve an image, a chart, or a page screenshot. This matters for corpora where the meaning is in the layout: slide decks, scanned forms, diagrams, and PDFs whose text extraction loses tables.

As of November 2026, three hosted options cover this:

  • Google's gemini-embedding-2 accepts text, up to six images, up to 180 seconds of audio, up to 120 seconds of video, or a PDF of up to six pages per request, within an 8,192-token limit shared across modalities.
  • Cohere's embed-v5.0-pro and embed-v5.0-fast accept text, images, and mixed text-and-image inputs such as PDF pages.
  • Voyage's voyage-multimodal-3.5 embeds interleaved text and images, including screenshots and slides, and video, with a 32,000-token context.

Embedding a page image avoids a fragile extraction step but gives up exact text. A part number or a clause that a text index could match exactly is now only as findable as the image embedding makes it. Many teams index both: page images for layout-heavy content and extracted text for keyword search.

Hosted APIs or open weights

A hosted API gives you a model with no serving infrastructure, at a per-token price, with your text sent to the vendor. Open weights give you control over where data goes, no per-token fee, and a model version nobody can retire, at the cost of running inference yourself.

The trade-offs are concrete:

  • Data handling. Every document and every query passes through a hosted API. For regulated data, that is a review with the vendor's terms, regions, and retention policy, or a reason to self-host.
  • Version risk. A hosted model can be deprecated on the vendor's schedule, and since vectors from a new model cannot share the old index, that schedule becomes your re-embedding schedule. An open-weight model you host changes only when you change it.
  • Serving cost. Indexing a large corpus is a batch job that a GPU handles well, and query embedding is a small, latency-sensitive call on every request. Self-hosting pays for capacity for both. Size it from your query rate, not your corpus size.
  • License. bge-m3 is MIT-licensed and Qwen3-Embedding-8B is Apache 2.0. Read the license of any other open model before shipping it, because some restrict commercial use.

Model size matters for open weights. Qwen3-Embedding-8B has 8 billion parameters, which needs a GPU to embed queries quickly, while smaller models in the same family and bge-m3 run on far less hardware. Benchmark the smaller variant before assuming you need the largest.

What embeddings cost

Embedding cost has three parts: the one-time indexing run, the per-query embedding call, and vector storage. The first two are small for most teams. OpenAI lists text-embedding-3-small at $0.02 per million input tokens and text-embedding-3-large at $0.13. Voyage lists voyage-4-lite at $0.02, voyage-4 at $0.06, and voyage-4-large at $0.12 per million tokens, with the first 200 million tokens free on each.

At those prices, embedding a 100-million-token corpus once costs $2 to $13 with OpenAI's models. Storage and memory for the index usually cost more over a year than the embedding calls, which is why dimensions and quantization deserve more attention than per-token price.

The cost that surprises teams is re-embedding. Every model change, prefix change, chunking change, or dimension change means embedding the whole corpus again and rebuilding the index, so the real price of a model includes how often you expect to change it.

Why you can't mix embedding models in one index

Each embedding model defines its own vector space, so a vector from one model compared with a vector from another produces a number with no meaning. This holds even between versions from one vendor: Google's docs state that the embedding spaces of gemini-embedding-001 and gemini-embedding-2 are incompatible, and that upgrading means re-embedding existing data. Two models with the same dimension count are no more compatible than two with different counts, and the index will not stop you, because it only checks the vector length.

A few vendors now design families that share a space. Voyage states that all embeddings from its 4 series are compatible with each other, so a corpus indexed with voyage-4-large can be queried with voyage-4-lite. Cohere states that embed-v5.0-pro and embed-v5.0-fast share an embedding space and recommends indexing with Pro and querying with Fast. Outside a stated shared family, assume no compatibility.

Migrate the way you would migrate a database:

  1. Build a second index with the new model alongside the old one.
  2. Backfill it from the source documents, and dual-write new documents to both indexes.
  3. Run your evaluation set against both, and shadow a share of production queries to compare results.
  4. Switch reads to the new index, keep the old one until the new one has run clean, then delete it.

How to test embedding models on your own queries

Test two or three shortlisted models on labeled queries from your own users, holding everything else fixed, and pick on recall at k. The RAG evaluation guide covers the metrics in depth. The minimum version is short:

  1. Collect 50 to 100 real queries, from search logs or support tickets rather than generated from your documents. For each, mark the passages that answer it by their position in the source document, so labels survive re-chunking.
  2. Chunk the corpus once and reuse those exact chunks for every model. A comparison where chunking also changed tells you nothing about the model.
  3. Embed with each model at the dimensions and quantization you would deploy, with each model's recommended query and document prefixes.
  4. Measure recall at k for the k your pipeline passes on, at 5, 10, or 20, and nDCG if order matters to you. Add a hybrid run with keyword search and see how much of the gap between models it closes.
  5. Read the misses. Queries with exact identifiers, negation, or rare terms show where dense retrieval needs a keyword index or a reranker regardless of which model wins.
compare.py
def recall_at_k(ranked_ids: list[list[str]], relevant: list[set[str]], k: int) -> float:
    hits = [bool(set(ranked[:k]) & rel) for ranked, rel in zip(ranked_ids, relevant)]
    return sum(hits) / len(hits)
 
for model in ["candidate-a", "candidate-b", "candidate-c"]:
    ranked = [search(model, q, k=20) for q in queries]
    print(model, {k: round(recall_at_k(ranked, labels, k), 3) for k in (5, 10, 20)})

Compare per query, not only on the average. With 100 queries, a difference of one or two questions is within noise, so a cheaper or smaller model that ties a larger one on your data is the better pick. If retrieval is good and answers are still wrong, the problem is downstream: what the model is shown and how it uses it, which RAG vs fine-tuning and the RAG evaluation guide cover.

Frequently asked questions

What is an embedding model?

An embedding model is a neural network that converts an input, usually a piece of text, into a fixed-length list of numbers called a vector. Inputs with similar meaning get vectors that point in similar directions, so a system can find related text by comparing vectors instead of matching words.

What is the best embedding model for RAG?

No model is best for every corpus. Use the retrieval column of the MTEB leaderboard to shortlist two or three models that fit your input length, languages, deployment, and budget, then compare their recall at k on 50 to 100 labeled queries from your own users.

What are Matryoshka embeddings?

Matryoshka embeddings come from models trained so that the first part of each vector is a usable embedding on its own. You can keep the first 256 or 512 numbers of a longer vector, re-normalize it, and search with it at lower storage and compute cost. Truncating a vector from a model not trained this way gives poor results.

Can I mix embeddings from different models in one index?

No. Each model has its own vector space, so a similarity score between vectors from two models has no meaning. Changing models means re-embedding every document. The exception is a model family that its vendor states shares one embedding space, such as Voyage's 4 series.

Should I use cosine similarity or dot product?

For normalized vectors they give the same ranking, and Euclidean distance does too. OpenAI's embeddings are normalized to length 1, so a dot product computes cosine similarity directly. If you truncate vectors yourself, normalize them again before using a dot product.

What are multimodal embeddings?

Multimodal embeddings place more than one kind of input, such as text and images, in the same vector space, so a text query can retrieve an image or a page screenshot. Google's gemini-embedding-2, Cohere's Embed 5 models, and Voyage's voyage-multimodal-3.5 accept images alongside text as of November 2026.

Sources

  1. 01Vector embeddingsOpenAI API docs
  2. 02PricingOpenAI API docs
  3. 03EmbeddingsGoogle AI Studio docs
  4. 04Text embeddingsVoyage AI docs
  5. 05Multimodal embeddingsVoyage AI docs
  6. 06PricingVoyage AI docs
  7. 07Cohere's Embed modelsCohere docs
  8. 08Qwen3-Embedding-8B model cardHugging Face
  9. 09BGE-M3 model cardHugging Face
  10. 10Matryoshka Representation LearningarXiv:2205.13147
  11. 11MMTEB: Massive Multilingual Text Embedding BenchmarkarXiv:2502.13595
  12. 12Maintaining MTEB: Towards Long Term Usability and Reproducibility of Embedding BenchmarksarXiv:2506.21182
  13. 13On the Theoretical Limitations of Embedding-Based RetrievalarXiv:2508.21038
  14. 14MTEB leaderboardHugging Face
  15. 15pgvectorGitHub