COMPARISONS · EMBEDDINGS

Best embedding model for code in 2026: 9 models compared

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-11-22 · UPDATED · 2026-11-22
SHORT ANSWER · UPDATED 2026-11-22

What is the best embedding model for code search and code RAG in 2026?

Key number: For open weights with a commercial licence, Qwen3-Embedding is the strongest all round pick and nomic-embed-code is the strongest code only pick. voyage-code-4 is the hosted option built for coding agents.

Licences, parameter counts and 30 day downloads checked on Hugging Face on 22 Nov 2026. Scores copied from each model card.

TL;DR There is no single leaderboard every code model reports on, so read the scores per row. Qwen3-Embedding covers code and 100+ languages under Apache 2.0, from 0.6B to 8B. nomic-embed-code (7B, Apache 2.0) reports 81.7 on CodeSearchNet Python. For a small local model, EmbeddingGemma (300M) and jina-embeddings-v2-base-code (161M) run on a laptop. The Jina code and SFR code models score well but are licensed for non commercial use only.

TOOL · FILTER

Filter code embedding models by what you need

I need

Sort by

ModelParamsDimsMax tokensLicenceReported code scoreDownloads 30d
Qwen3-Embedding-8B7.6Bup to 4,09632KApache 2.0MTEB English v2 75.22 (all tasks)2,137,838
Qwen3-Embedding-0.6B0.6Bup to 1,02432KApache 2.0MTEB Code retrieval 75.41 (Qwen run)7,254,821
nomic-embed-code7.1B3,58432K (config)Apache 2.0CodeSearchNet Python 81.7285,668
voyage-code-4n/a1,024 (256 to 2,048)32KCommercial APIBuilt for code retrieval and coding agentsAPI
voyage-code-3n/a1,024 (256 to 2,048)32KCommercial APICodeSearchNet Python 80.8 (Nomic table)API
EmbeddingGemma-300m0.3B768 (512, 256, 128)2KGemma terms (gated)MTEB Code v1 68.76947,398
jina-embeddings-v2-base-code161M7688,192Apache 2.030 programming languages119,627
jina-code-embeddings-1.5b1.5B1,536 (down to 128)32,768CC BY NC 4.00.5B sibling: CoIR 73.94 (Jina table)5,048
SFR-Embedding-Code-2B_R2.6B2,3048,192 (config)CC BY NC 4.0CoIR average 67.41,097

Scores come from different benchmarks, so compare them within a row family, not across rows. Downloads are the last 30 days on Hugging Face, read on 22 Nov 2026. Voyage is API only, so it has no download count.
PASTE THIS TO YOUR AI AGENT. IT DOES THE REST Read https://xerj.org/compare/best-embedding-model-for-code-2026.md. Ask me about my languages, repo size, hardware and licence rules, then pick one code embedding model and show me how to index my repo with it.

Pick one in ten seconds

When to choose Qwen3-Embedding

Choose Qwen3-Embedding when you want one model family for code, docs and many human languages. The card lists 100+ languages including programming languages, 32K context, and output size you can shrink. The 0.6B model is the most downloaded code capable model here at 7.25M in 30 days. In Qwen's own run on the MTEB Code retrieval subset it scores 75.41.

When to choose nomic-embed-code

Choose nomic-embed-code when retrieval quality on code matters most and you have a GPU. Its card reports CodeSearchNet scores of 81.7 for Python, 80.5 for Java and 93.8 for Go, ahead of Voyage Code 3 on Python (80.8) and OpenAI Embed 3 Large (70.8). It is 7B parameters with 3,584 dimension vectors, so storage per chunk is high.

When to choose Voyage code models

Choose voyage-code-4 or voyage-code-3 when you prefer an API. Both take 32,000 tokens and return 1,024 dimensions by default, with 256, 512 and 2,048 as options. The docs describe voyage-code-4 as tuned for code retrieval and coding agent use cases.

When to choose a small local model

Choose EmbeddingGemma-300m for a strong small model: Google reports 68.76 on MTEB Code v1 at 768 dimensions, with 2K context. Accept the Gemma terms on Hugging Face first. Choose jina-embeddings-v2-base-code (161M, Apache 2.0, 8,192 tokens) when you need a permissive licence and long chunks on CPU.

When to choose Jina code or SFR code models

Both families publish strong CoIR scores: 73.94 for jina-code-embeddings-0.5b in Jina's table and 67.4 for SFR-Embedding-Code 2B in Salesforce's. Both are CC BY NC 4.0, so they suit research and evaluation. Check the licence before production use.

Do you need embeddings for code search at all?

Often the fastest win is exact search first. Identifiers, error strings and file paths match lexically, and embeddings help with "where do we retry failed payments" style questions. XERJ is a new way for AI to search for data: it gives coding agents lexical search over your repo by default and lets you add vectors when you need them. See XERJ vs a vector database.

How we checked

Parameter counts, licences and 30 day downloads come from the Hugging Face API on 22 Nov 2026. Dimensions and context come from model cards, Google AI docs and Voyage docs; two context values are read from the model config and marked. Scores are quoted from the card that published them; we did not rerun them.

Read next

FAQ

What is the best embedding model for code in 2026?

For open weights you can use commercially, Qwen3-Embedding is the best all round choice and nomic-embed-code is the best code only choice, with 81.7 on CodeSearchNet Python in its card. For an API, Voyage offers voyage-code-4 and voyage-code-3.

What is the best small embedding model for code?

EmbeddingGemma-300m reports 68.76 on MTEB Code v1 with 768 dimensions. jina-embeddings-v2-base-code has 161M parameters, an Apache 2.0 licence and 8,192 tokens of context.

Which code embedding models allow commercial use?

Qwen3-Embedding, nomic-embed-code and jina-embeddings-v2-base-code are Apache 2.0. EmbeddingGemma uses the Gemma terms. jina-code-embeddings and SFR-Embedding-Code are CC BY NC 4.0, which is non commercial.

How many dimensions should code embeddings have?

Start at 768 or 1,024. Models with flexible size, such as Qwen3-Embedding, EmbeddingGemma, Voyage and jina-code-embeddings, let you go smaller to save storage and test the quality drop on your own queries.

Can I run a code embedding model in Ollama?

Yes for Qwen3-Embedding and EmbeddingGemma, which are in the official Ollama library as qwen3-embedding and embeddinggemma on 22 Nov 2026. nomic-embed-code is not listed there, so run it with sentence-transformers.

Evidence