How We Chose an Embedding Model for RAG: bge-m3 vs. Gemini Embedding 2
See how we tested bge-m3 and Gemini Embedding 2 for RAG, and why document privacy and a 1,536-dimension limit shaped our choice.
If an AI assistant answers from your company documents, it has to find the right page first. Even a good writing model can give a poor answer if it never sees the passage it needs. How well the assistant finds that passage matters. So does where your documents go during the search.
Retrieval-augmented generation (RAG) is a way to look up relevant passages before writing an answer. An embedding model turns text into a list of numbers, called a vector, so the search can match a question to passages with similar meaning. To choose a model, we tested it on our own material rather than relying on a public leaderboard.
How we tested retrieval with known answers
We used two collections: a library of public AI vendor documentation and a library of published professional guides. Each had 87 test questions. For every question, we knew which page held the answer. We checked whether that page came back first, in the top three, or in the top five.
We compared the models in two ways:
- Rank the live index's top 20 results. This shows what each model can do with an existing shortlist. But the shortlist favors the model that built the index. A different model can't pick a page that didn't make the cut.
- Rank all 376 passages from one guide. Every model starts with the same set of passages. That makes it the fairer comparison.
Which embedding models and rerankers we tested
- BAAI: bge-m3 and bge-base-en-v1.5
- Qwen: Qwen3-Embedding 8B, 4B, and 0.6B
- Google: EmbeddingGemma 300M and Gemini Embedding 2
- OpenAI: text-embedding-3-large and text-embedding-3-small
- Voyage: Voyage 4 large and lite
- Perplexity: pplx-embed 0.6B
We also tested rerankers. A reranker takes the search results and puts them in a new order before the assistant sees them.
- Cloudflare: bge-reranker-base
- Cohere: Rerank 4 Pro, 5 Pro, and 5 Fast
- Voyage: rerank-2.5 and rerank-2.5-lite
- Qwen: Qwen3 Reranker 8B and 0.6B
- Nemotron Rerank
Every reranker matched or scored below our baseline on our data, so we didn't add one.
What came back first
Gemini Embedding 2 put the right answer first most often in both collections. The size of the lead was different.
| Embedding model | Published guides | Public vendor docs |
|---|---|---|
| Gemini Embedding 2 | 89% | 80% |
| Qwen3-Embedding 8B | 82% with a task instruction | 71% |
| bge-m3 | 76% | 79% on the live index |
On the guides, telling Qwen what kind of match to look for raised its first-place score from 71% to 82%. That same instruction made no difference on the vendor docs. With Gemini, embedding all 376 passages from the guide plus the 87 questions cost under a cent, about $0.008 in that test.
Why we use Gemini for the guides and keep bge-m3
We use Gemini Embedding 2 for the published guides. We kept the vendor library on bge-m3 because Gemini put the right page first on just one more question there.
For private material, the decision starts with where the text goes. Our bge-m3 setup runs on Cloudflare Workers AI, so the text stays within Cloudflare. When we call Gemini through OpenRouter, the text goes to Google. We use Gemini only for public or already-published material. Client and personal data stay on bge-m3.
How the 1,536-dimension limit shaped the choice
A dimension is one number in a vector. Cloudflare Vectorize accepts up to 1,536 dimensions per vector. The 1,024 dimensions from bge-m3 fit as-is. Gemini returns 3,072 by default, so we asked it for 1,536 and rebuilt the guides index at that size.
With Qwen, cutting from 4,096 dimensions to 1,536 moved the first-place score from 82% to 80%. We didn't see a measurable loss in that test.
Postgres with pgvector, as available on Supabase, can index vectors up to 2,000 dimensions. Its half-precision type, called halfvec, raises that limit to 4,000. The full 3,072-dimension Gemini vectors would fit with halfvec, but we haven't tested that setup. We don't know whether the larger vectors would retrieve better results.
Start with your own documents
Before you pick a model, decide where your documents are allowed to go. Then take questions your team actually asks, mark the pages that answer them, and see what the search brings back.
Talk to Safire Business Services about testing retrieval on your own documents. As part of our AI consulting, we can help you set up a known-answer test, decide where your data may go, and choose a vector store that fits.