nomic-ai / CodeRankEmbed

huggingface.co
Total runs: 313.1K
24-hour runs: 11.8K
7-day runs: -8.7K
30-day runs: 5.3K
Model's Last Updated: June 24 2025

Introduction of CodeRankEmbed

Model Details of CodeRankEmbed

CodeRankEmbed

CodeRankEmbed is a 137M bi-encoder supporting 8192 context length for code retrieval. It significantly outperforms various open-source and proprietary code embedding models on various code retrieval tasks.

Check out our blog post and paper for more details!

Combine CodeRankEmbed with our re-ranker CodeRankLLM for even higher quality code retrieval.

Performance Benchmarks

Name Parameters CSN (MRR) CoIR (NDCG@10)
CodeRankEmbed 137M 77.9 60.1
Arctic-Embed-M-Long 137M 53.4 43.0
CodeSage-Small 130M 64.9 54.4
CodeSage-Base 356M 68.7 57.5
CodeSage-Large 1.3B 71.2 59.4
Jina-Code-v2 161M 67.2 58.4
CodeT5+ 110M 74.2 45.9
OpenAI-Ada-002 110M 71.3 45.6
Voyage-Code-002 Unknown 68.5 56.3

We release the scripts to evaluate our model's performance here .

Usage

Important : the query prompt must include the following task instruction prefix : "Represent this query for searching relevant code"

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("nomic-ai/CodeRankEmbed", trust_remote_code=True)
queries = ['Represent this query for searching relevant code: Calculate the n-th factorial']
codes = ['def fact(n):\n if n < 0:\n  raise ValueError\n return 1 if n == 0 else n * fact(n - 1)']
query_embeddings = model.encode(queries)
print(query_embeddings)
code_embeddings = model.encode(codes)
print(code_embeddings)
Training

We use a bi-encoder architecture for CodeRankEmbed , with weights shared between the text and code encoder. The retriever is contrastively fine-tuned with InfoNCE loss on a 21 million example high-quality dataset we curated called CoRNStack . Our encoder is initialized with Arctic-Embed-M-Long , a 137M parameter text encoder supporting an extended context length of 8,192 tokens.

Runs of nomic-ai CodeRankEmbed on huggingface.co

313.1K
Total runs
11.8K
24-hour runs
-923
3-day runs
-8.7K
7-day runs
5.3K
30-day runs

More Information About CodeRankEmbed huggingface.co Model

More CodeRankEmbed license Visit here:

https://choosealicense.com/licenses/mit

CodeRankEmbed huggingface.co

CodeRankEmbed huggingface.co is an AI model on huggingface.co that provides CodeRankEmbed's model effect (), which can be used instantly with this nomic-ai CodeRankEmbed model. huggingface.co supports a free trial of the CodeRankEmbed model, and also provides paid use of the CodeRankEmbed. Support call CodeRankEmbed model through api, including Node.js, Python, http.

CodeRankEmbed huggingface.co Url

https://huggingface.co/nomic-ai/CodeRankEmbed

nomic-ai CodeRankEmbed online free

CodeRankEmbed huggingface.co is an online trial and call api platform, which integrates CodeRankEmbed's modeling effects, including api services, and provides a free online trial of CodeRankEmbed, you can try CodeRankEmbed online for free by clicking the link below.

nomic-ai CodeRankEmbed online free url in huggingface.co:

https://huggingface.co/nomic-ai/CodeRankEmbed

CodeRankEmbed install

CodeRankEmbed is an open source model from GitHub that offers a free installation service, and any user can find CodeRankEmbed on GitHub to install. At the same time, huggingface.co provides the effect of CodeRankEmbed install, users can directly use CodeRankEmbed installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

CodeRankEmbed install url in huggingface.co:

https://huggingface.co/nomic-ai/CodeRankEmbed

Url of CodeRankEmbed

CodeRankEmbed huggingface.co Url

Provider of CodeRankEmbed huggingface.co

nomic-ai
ORGANIZATIONS

Other API from nomic-ai

huggingface.co

Total runs: 15.3K
Run Growth: -3.9K
Growth Rate: -25.60%
Updated:June 24 2025
huggingface.co

Total runs: 2.0K
Run Growth: -110
Growth Rate: -5.42%
Updated:April 08 2024
huggingface.co

Total runs: 833
Run Growth: -253
Growth Rate: -30.37%
Updated:May 25 2023