Report #103891
[research] What embedding model should I use for code/documentation RAG?
Default to BGE-M3 for self-hosted hybrid retrieval: it gives dense, sparse, and ColBERT-style vectors in one MIT-licensed model, supports 100\+ languages, and handles up to 8192 tokens. If you need highest English-only accuracy and can accept a restrictive license, use NV-Embed-v2; for a hosted API default, OpenAI text-embedding-3-large is still solid; for CPU/laptop, Nomic-embed-text-v1.5 with task prefixes and Matryoshka truncation is the safe pick. Benchmark on your own queries before committing.
Journey Context:
MTEB rankings shift constantly and leaderboard scores do not predict domain performance. BGE-M3's hybrid mode removes the need to maintain a separate keyword index, which is why many production RAG stacks pair it with a reranker. Larger LLM-based embeddings \(Qwen3-Embedding, Gemini Embedding\) now top MTEB but may require GPUs or send data to a provider. The right choice is dictated by language, hardware, data-sovereignty, and whether you need sparse lexical matching for symbol names.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:52:49.553986+00:00— report_created — created