Dev tools
How to Choose an Embedding Model for RAG
How to choose an embedding model for RAG: what matters, MTEB, API vs open-source options, Ollama models, pricing and storage, and how to test.
An embedding model turns text (or images) into lists of numbers, called vectors, that capture meaning, so a search system can find passages that mean the same thing as a question even when the words differ. In a RAG app, the embedding model decides which passages the language model ever gets to see, so it has a big effect on answer quality. The best embedding model for RAG is the one that retrieves the right passages for your documents, languages and budget. Public leaderboards help you shortlist, but a quick test on your own data decides.
This guide explains what to look for in an embedding model, how to read the MTEB leaderboard, the main API and open-source options, the best embedding model for Ollama and local use, embedding model pricing and storage maths, and a simple way to test models on your own data. For the basics of how embeddings work, see our guide to embeddings.
What to Look For in an Embedding Model
| Factor | Why it matters |
|---|---|
| Retrieval quality on your data | The point of the model: does it find the right passages? |
| Languages | Multilingual models handle mixed-language documents and questions; English-only models may be better and cheaper for English |
| Domain | Code, legal, medical and financial text can need specialised or larger models |
| Maximum input length | Longer limits allow bigger chunks; most are 512 to 8,000+ tokens |
| Vector dimensions | More dimensions can mean better quality but more storage and slower search |
| Cost | API price per million tokens, or GPU cost to self-host |
| Speed | Latency to embed each query matters for user-facing search |
| Licence and privacy | Open-source models can run on your own servers; check commercial-use terms |
| Flexible dimensions | Some models let you shorten vectors (Matryoshka embeddings) or quantise them with little loss |
How to Read the MTEB Leaderboard
The Massive Text Embedding Benchmark (MTEB), hosted on Hugging Face, is the standard public comparison of embedding models across tasks such as retrieval, classification, clustering and reranking, with multilingual and domain-specific versions. To use it well:
- Look at the retrieval scores, not just the overall average, since RAG is a retrieval task.
- Filter by language if your content isn't English.
- Check model size and dimensions: a top model with billions of parameters may be too slow or expensive for your use.
- Treat small differences as noise: a point or two on average often doesn't show up on your data.
- Remember scores are mostly self-reported and benchmarks can leak into training data, as with other AI benchmarks.
The leaderboard changes often. In late 2026, large open-weight models such as the Qwen3-Embedding family and other new releases sit near the top, often above commercial APIs on the benchmark.
Embedding Model Options at a Glance
API models
| Model family | Provider | Notes |
|---|---|---|
| text-embedding-3-small / -large | OpenAI | Widely used; small is very cheap (about $0.02 per million tokens) and large costs about $0.13; both allow shorter vectors |
| gemini-embedding-001 | Strong benchmark scores, multilingual, flexible dimensions; about $0.15 per million tokens | |
| Embed models | Cohere | Multilingual, with multimodal (text and image) support and compression options |
| Voyage models | Voyage AI (part of MongoDB) | General and domain-specific models for code, finance and law |
Open-source models
| Model | Notes |
|---|---|
| Qwen3-Embedding (0.6B, 4B, 8B) | Apache 2.0, multilingual, top-tier benchmark results; larger sizes need a GPU |
| BGE-M3 | Multilingual, supports dense, sparse and multi-vector retrieval in one model |
| EmbeddingGemma | Small (about 300 million parameters) model from Google designed for on-device use |
| nomic-embed-text | Popular, efficient English model with long input support |
| jina embeddings | Multilingual, long-context models from Jina AI |
| all-MiniLM-L6-v2 | Very small and fast English model; fine for prototypes, weaker for demanding retrieval |
Prices and rankings change often; check providers' current pricing pages and the live leaderboard before deciding.
Best Embedding Model for RAG
There's no single best embedding model for RAG, but practical starting points:
- Fast start with an API: OpenAI text-embedding-3-small for low cost, or text-embedding-3-large or Gemini embedding for higher quality.
- Multilingual content: Gemini embedding, Cohere's multilingual models, BGE-M3 or Qwen3-Embedding.
- Code search: a code-specialised model, such as Voyage's code models, or a strong general model tested on your repository.
- Privacy or on-premises: an open-source model such as Qwen3-Embedding or BGE-M3 on your own GPU.
- Edge or mobile: a small model such as EmbeddingGemma.
Whatever you choose, retrieval quality usually improves more from good chunking, hybrid search and a reranker than from switching between top embedding models. Our guides to hybrid search and reranking cover those steps.
Embedding Models for RAG: Open Source vs API
Embedding models for RAG that are open source give you control; APIs give you convenience:
| API models | Open-source models | |
|---|---|---|
| Setup | An API key | Download and serve (Ollama, Hugging Face, a serving engine) |
| Cost | Per token, low for most projects | Hardware and maintenance; cheap at high volume |
| Privacy | Data sent to the provider | Stays on your servers |
| Quality | Strong, consistent | Top open models match or beat APIs on benchmarks |
| Lock-in | Switching means re-embedding everything | Same, but you control the model version |
One important point either way: if you change embedding models later, you must re-embed all your documents, because vectors from different models aren't compatible.
Best Embedding Model for Ollama
The best embedding model for Ollama depends on your hardware and languages. Popular choices in Ollama's library include:
- nomic-embed-text: a good default for English, small and fast.
- mxbai-embed-large: strong English retrieval at a moderate size.
- bge-m3: multilingual, larger.
- embeddinggemma: small and efficient.
- qwen3-embedding: high quality, with larger variants needing more memory.
You call them through Ollama's embeddings API, and most RAG frameworks and tools such as Open WebUI and AnythingLLM can use them directly.
Embedding Model Pricing and Storage
Embedding model pricing is usually small next to language model costs, but storage can surprise you. Illustrative example: 1 million document chunks of about 500 tokens each, so 500 million tokens to embed once.
| Model | Price per million tokens | One-time embedding cost | Dimensions | Storage for 1M vectors (32-bit floats) |
|---|---|---|---|---|
| text-embedding-3-small | About $0.02 | About $10 | 1,536 | About 6 GB |
| text-embedding-3-large | About $0.13 | About $65 | 3,072 | About 12 GB |
| gemini-embedding-001 | About $0.15 | About $75 | 3,072 (or fewer) | About 12 GB |
| Self-hosted open model | GPU time | Depends on hardware | 768–4,096 | 3–16 GB |
Ways to cut storage and search cost:
- Shorten vectors on models that support it (for example 3,072 down to 1,024 dimensions) with a small quality loss.
- Quantise vectors to 8-bit integers (a quarter of the size) or binary (one thirty-second). Many vector databases support this, often with a re-scoring step to recover accuracy.
- Don't over-chunk: fewer, well-made chunks mean fewer vectors.
Multimodal and Specialised Embedding Models
Some projects need more than general text embeddings:
- Multimodal models embed images and text in the same space, so a text query can find relevant images, charts or scanned pages. Several providers, including Cohere and Google, and open models such as CLIP-style and newer document models offer this.
- Code embedding models are trained on source code and documentation, and usually beat general models for searching repositories.
- Domain models for legal, financial or medical text can help when vocabulary is specialised.
- Multi-vector (late-interaction) models, such as ColBERT-style models, store several vectors per passage for finer-grained matching, at the cost of more storage.
Start with a strong general model, and only switch to a specialised one if your tests show it retrieves better on your data.
How to Test Embedding Models on Your Data
A simple evaluation takes an afternoon:
- Collect 50–200 real questions your users ask.
- Mark the right passages for each question in your documents (a few per question).
- Embed your documents with each candidate model (try two or three).
- Run each question and check whether the right passages appear in the top 5 or 10 results. Track recall at k and, if you like, MRR or nDCG.
- Add a reranker and test again; the ranking of models can change.
- Weigh quality against cost and speed, and pick the cheapest model that meets your bar.
Keep the test set; rerun it whenever you change models, chunking or retrieval settings.
Chunking and Your Embedding Model
The embedding model and your chunking strategy work together:
- Chunk size: most RAG systems use chunks of roughly 200–800 tokens. Too small and chunks lose context; too large and one vector has to represent several topics, which blurs search results.
- Overlap: a small overlap between chunks (for example 10–20%) helps when an answer spans a boundary.
- Structure-aware splitting: split on headings, paragraphs and sections rather than fixed character counts, so each chunk makes sense on its own.
- Add context: prefixing each chunk with its document title and section heading often improves retrieval noticeably, because the vector then "knows" what the chunk is about.
- Respect the input limit: text beyond a model's maximum input is usually cut off silently.
Test chunk sizes along with models, since the best size can differ by model.
Self-Hosting an Embedding Model
Running your own embedding model makes sense for privacy, high volume or offline use:
- Small models (up to a few hundred million parameters) run comfortably on a CPU or a laptop GPU, fast enough for many apps.
- Larger models (billions of parameters) need a GPU for reasonable speed when embedding large document sets.
- Serving options: Ollama for simple local use, Hugging Face's Text Embeddings Inference server, sentence-transformers in Python, or general serving engines that support embedding models.
- Batching: embed documents in batches for much higher throughput during indexing.
- Versioning: pin the exact model version, because an updated model produces different vectors.
A common pattern is to embed documents once in a batch job on a GPU, then serve query embeddings from a smaller instance, since queries are short and arrive one at a time.
Practical Tips
- Use the same model for queries and documents.
- Follow the model's input format: some models expect prefixes or instructions, such as marking text as a query or a passage, and perform worse without them.
- Match chunk size to the model's input limit, leaving room so text isn't silently cut off.
- Normalise vectors if your database and model expect cosine similarity.
- Record the model name and version with your vectors, so you know when re-embedding is needed.
FAQ
What is an embedding model?
An embedding model converts text, images or other data into vectors (lists of numbers) that capture meaning, so similar content ends up with similar vectors. It's the component that powers semantic search and retrieval in RAG systems.
What is the best embedding model for RAG?
It depends on your data, languages and budget. OpenAI's text-embedding-3 models and Google's Gemini embedding are popular API choices; Qwen3-Embedding and BGE-M3 are strong open-source options. Test two or three on your own questions before deciding.
Are open-source embedding models as good as OpenAI's?
The best open-source models score as well as or better than commercial APIs on public benchmarks. In practice, the difference on your data may be small, so choose based on privacy, cost, speed and a test on your own documents.
How much do embeddings cost?
API embedding is cheap: about $0.02 per million tokens for OpenAI's small model and around $0.13–$0.15 for larger models. Embedding 500 million tokens once costs roughly $10–$75 at those prices. Storage and vector database costs often matter more.
Do I need to re-embed if I change models?
Yes. Vectors from different embedding models aren't compatible, so switching models means re-embedding all your documents and rebuilding the index.