AI SeedbankHelp preserve open and free AI for humanity's future

← All models

nomic-ai_CodeRankEmbed

nomic-ai · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


base_model:

  • Snowflake/snowflake-arctic-embed-m-long library_name: sentence-transformers license: mit

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.

Citation

If you find the model, dataset, or training code useful, please cite our work:

@misc{suresh2025cornstackhighqualitycontrastivedata,
      title={CoRNStack: High-Quality Contrastive Data for Better Code Retrieval and Reranking}, 
      author={Tarun Suresh and Revanth Gangi Reddy and Yifei Xu and Zach Nussbaum and Andriy Mulyar and Brandon Duderstadt and Heng Ji},
      year={2025},
      eprint={2412.01007},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2412.01007}, 
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:17f91476bb0edcf5cdffe9dbe0a46d5a82d17bcb&dn=nomic-ai_CodeRankEmbed

Open magnet in torrent client · infohash 17f91476bb0edcf5cdffe9dbe0a46d5a82d17bcb

Files & hashes

PathSizesha1sha256
1_Pooling/config.json296 B (296 B)1b013adee922cdde26976d6e46f4ec75a651dfdfd02ebf56344d20f773449b15d0c10ee9a86a9178f3b3c9bfecb8b87d4350ce38
README.md3.0 KB (3,096 B)18560e2ecedc615f7cda733a5da9345037e1bcab69a6d76a2b533dd0f293b5d1b33a5b433201af38cf48c887b8ec795b641849a0
config.json1.5 KB (1,525 B)869d0dc117048385b522fb975e72773bdf8066135ff856a41d0f53ef2d74520627d464bd75c2efd8f26f381bd528654895c29b6c
config_sentence_transformers.json245 B (245 B)bca76e3a283255b3c69e365cd1a3781a59d258a906bc4c2dc7098e98669beb67cf21dc1373e44a77c7eecdf70aad6585d87190cf
configuration_hf_nomic_bert.py1.9 KB (1,955 B)e2bb675151e83b083ac8fab56a1bafb689afaf958632792e922e62ab1a6feaab15baf406e223c0547a21de23ab4f520b2b36d674
model.safetensors521.6 MB (546,938,168 B)337f5a07b4a4aceaabba9ea34f92c63df54bc3af827529bcd58aef0d9082e66eeff7e7d53a02f62bd005f841a26b3d3e2fb17ebe
modeling_hf_nomic_bert.py51.3 KB (52,571 B)8a731329ba5364dc8798df668b8ef35c4f796d89502ccfb9c2d5dac976109ac2f04dc3125d8540329e5d4af92bc587d6dc65edcd
modules.json229 B (229 B)f7640f94e81bb7f4f04daf1668850b38763a13d98f4b264b80206c830bebbdcae377e137925650a433b689343a63bdc9b3145460
sentence_bert_config.json140 B (140 B)f83195a00c2f0a5afb8a6fa31733549d26da9b28d8ecbf1eb946d17aec64c83e6614e5ec1b19b62498cf72a4ed4ec882c86af07e
special_tokens_map.json695 B (695 B)9bbecc17cabbcbd3112c14d6982b51403b264bfa5d5b662e421ea9fac075174bb0688ee0d9431699900b90662acd44b2a350503a
tokenizer.json695.0 KB (711,649 B)3c0e6344ec45a9a6e5a621d6711baf109c2d9f8791f1def9b9391fdabe028cd3f3fcc4efd34e5d1f08c3bf2de513ebb5911a1854
tokenizer_config.json1.4 KB (1,417 B)acb9e59bebff079933f88be0a37f96d113f42c937809f768ee3614618b3f1b91dcbfab4f6a9d4b79fb1ad5d17feb65a7c1bb5b7a
vocab.txt226.1 KB (231,508 B)fb140275c155a9c7c5a3b3e0e77a9e839594a93807eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3

Cite this release

Canonical URL
https://aiseedbank.org/models/nomic-ai_CodeRankEmbed/
Slug
nomic-ai_CodeRankEmbed
Infohash
17f91476bb0edcf5cdffe9dbe0a46d5a82d17bcb
License
mit
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: nomic-ai_CodeRankEmbed.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorynomic-ai/CodeRankEmbed
Revision (pinned)3c4b60807d71f79b43f3c4363786d9493691f8b1
Fetched at2026-09-04T03:20:38Z
License at fetchmit
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T03:20:46Z

mit522.6 MB (547,943,494 bytes)sentence-transformerssafetensorsnomic_bertcustom_codepaper: 2412.01007