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

← All models

nomic-ai_nomic-embed-code

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.


library_name: sentence-transformers pipeline_tag: sentence-similarity tags:

  • sentence-transformers
  • sentence-similarity
  • feature-extraction license: apache-2.0 datasets:
  • nomic-ai/cornstack-python-v1
  • nomic-ai/cornstack-javascript-v1
  • nomic-ai/cornstack-java-v1
  • nomic-ai/cornstack-go-v1
  • nomic-ai/cornstack-php-v1
  • nomic-ai/cornstack-ruby-v1 base_model:
  • Qwen/Qwen2.5-Coder-7B-Instruct

Nomic Embed Code: A State-of-the-Art Code Retriever

Blog | Technical Report | AWS SageMaker | Atlas Embedding and Unstructured Data Analytics Platform

nomic-embed-code is a state-of-the-art code embedding model that excels at code retrieval tasks:

  • High Performance: Outperforms Voyage Code 3 and OpenAI Embed 3 Large on CodeSearchNet
  • Multilingual Code Support: Trained for multiple programming languages (Python, Java, Ruby, PHP, JavaScript, Go)
  • Advanced Architecture: 7B parameter code embedding model
  • Fully Open-Source: Model weights, training data, and evaluation code released
Model Python Java Ruby PHP JavaScript Go
Nomic Embed Code 81.7 80.5 81.8 72.3 77.1 93.8
Voyage Code 3 80.8 80.5 84.6 71.7 79.2 93.2
OpenAI Embed 3 Large 70.8 72.9 75.3 59.6 68.1 87.6
Nomic CodeRankEmbed-137M 78.4 76.9 79.3 68.8 71.4 92.7
CodeSage Large v2 (1B) 74.2 72.3 76.7 65.2 72.5 84.6
CodeSage Large (1B) 70.8 70.2 71.9 61.3 69.5 83.7
Qodo Embed 1 7B 59.9 61.6 68.4 48.5 57.0 81.4

Model Architecture

  • Total Parameters: 7B
  • Training Approach: Trained on the CoRNStack dataset with dual-consistency filtering and progressive hard negative mining
  • Supported Languages: Python, Java, Ruby, PHP, JavaScript, and Go

Usage Guide

Installation

You can install the necessary dependencies with:

pip install transformers sentence-transformers torch

Transformers

import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained("nomic-ai/nomic-embed-code")
model = AutoModel.from_pretrained("nomic-ai/nomic-embed-code")

def last_token_pooling(hidden_states, attention_mask):
    sequence_lengths = attention_mask.sum(-1) - 1
    return hidden_states[torch.arange(hidden_states.shape[0]), sequence_lengths]

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)']
code_snippets = queries + codes

encoded_input = tokenizer(code_snippets, padding=True, truncation=True, return_tensors='pt')
model.eval()
with torch.no_grad():
    model_output = model(**encoded_input)[0]

embeddings = last_token_pooling(model_output, encoded_input['attention_mask'])
embeddings = F.normalize(embeddings, p=2, dim=1)
print(embeddings.shape)

similarity = F.cosine_similarity(embeddings[0], embeddings[1], dim=0)
print(similarity)

SentenceTransformers

from sentence_transformers import SentenceTransformer

queries = ['Calculate the n-th factorial']
code_snippets = ['def fact(n):\n if n < 0:\n  raise ValueError\n return 1 if n == 0 else n * fact(n - 1)']

model = SentenceTransformer("nomic-ai/nomic-embed-code")
query_emb = model.encode(queries, prompt_name="query")
code_emb = model.encode(code_snippets)

similarity = model.similarity(query_emb[0], code_emb[0])
print(similarity)

CoRNStack Dataset Curation

Starting with the deduplicated Stackv2, we create text-code pairs from function docstrings and respective code. We filtered out low-quality pairs where the docstring wasn't English, too short, or that contained URLs, HTML tags, or invalid characters. We additionally kept docstrings with text lengths of 256 tokens or longer to help the model learn long-range dependencies.

After the initial filtering, we used dual-consistency filtering to remove potentially noisy examples. We embed each docstring and code pair and compute the similarity between each docstring and every code example. We remove pairs from the dataset if the corresponding code example is not found in the top-2 most similar examples for a given docstring.

During training, we employ a novel curriculum-based hard negative mining strategy to ensure the model learns from challenging examples. We use a softmax-based sampling strategy to progressively sample hard negatives with increasing difficulty over time.

Join the Nomic Community

  • Nomic Embed Ecosystem: https://www.nomic.ai/embed
  • Website: https://nomic.ai
  • Twitter: https://twitter.com/nomic_ai
  • Discord: https://discord.gg/myY5YDR8z8

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:7bf17f33ccbd059fe56a6d9014e15355f7dcc028&dn=nomic-ai_nomic-embed-code

Open magnet in torrent client · infohash 7bf17f33ccbd059fe56a6d9014e15355f7dcc028

Files & hashes

PathSizesha1sha256
1_Pooling/config.json297 B (297 B)78c8a66c7e1f3343e710432b7b34fb4c4244ad4394272b648336b99f82b04e165ddc8efb8476a21ded0ce2d2ab6deaf511f292de
README.md5.7 KB (5,841 B)46d011ef758263b213ab3688f392fe82d935d4447a044c742bfa76547c5eb91106e04c20c71bcb3fcf871cfcfec4938a622ca986
added_tokens.json605 B (605 B)482ced4679301bf287ebb310bdd1790eb451423258b54bbe36fc752f79a24a271ef66a0a0830054b4dfad94bde757d851968060b
config.json704 B (704 B)e7c4b13eded30866e52e6446c1c0521fe22c71d3245287b1c81bdf4ce9223671a612146d842268f76ced85623e711061df581b6f
config_sentence_transformers.json274 B (274 B)6c1d1487f17464f2bdb7c5444d97fa35d25ca5b7e26fdbd3f969e63d3fff779a1333f12c28b272a40e9841e7677b756b57ee8af2
merges.txt1.6 MB (1,671,853 B)31349551d90c7606f325fe0f11bbb8bd5fa0d7c78831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
model-00001-of-00006.safetensors4.63 GB (4,976,686,992 B)e62a051c6946fcf15205416fafd55a1a5d47c72ce33053439bc99e1fdc72a0ad6d9f0bae0b9afc84c34b51e0e8986dd769359eda
model-00002-of-00006.safetensors4.45 GB (4,778,621,952 B)eac1be1942fbf56604b9ece375fedaab9914c243a3ada145dd42a034de6267ad12d2cc02043b1bc41738590094ace97ed261e457
model-00003-of-00006.safetensors4.59 GB (4,932,743,600 B)a3927c0cf66d82d68a444c86da70eef9038a86c0d395d51ea31cd5b1551f9c15e836709f01f6af542d62089f06b7c06e709da0ff
model-00004-of-00006.safetensors4.59 GB (4,932,743,624 B)eeb30c1f86ed2bebf4768f8f5d570c27bfa4c77e9090fd22409a92917dc4e14540979574c7aeaf2bac12e51402f8983d1536e4d1
model-00005-of-00006.safetensors4.66 GB (4,998,851,880 B)855b565c0b3d035ad2e184c78b98361994e9efac4f212fd19c01b5e928fd5780257b2e4c9d617f4c3f5733294570eda2dcbe9972
model-00006-of-00006.safetensors3.41 GB (3,662,864,928 B)1e6c37ee161fbbbe91243118512dbd991a3dd7cfb2742bab0012d717fda6e18f7efff1146f8e7f44d678dc04cac83bddca0331e8
model.safetensors.index.json25.1 KB (25,666 B)8808252643318f540d9fb668b36cc8be1f163718945bc6c92ec7806e08a4595768a78f4d28f17ff9dc82b22d8a65486bd86ade8b
modules.json349 B (349 B)952a9b81c0bfd99800fabf352f69c7ccd46c5e4384e40c8e006c9b1d6c122e02cba9b02458120b5fb0c87b746c41e0207cf642cf
sentence_bert_config.json55 B (55 B)62244604e6bde5bb9ad3d244bfb0505e770d4d7a1140b92d307aec9383d897169c9f489f3a568787b80bf760f5d7cc9d25169a65
special_tokens_map.json613 B (613 B)ac23c0aaa2434523c494330aeb79c5839537810376862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
tokenizer.json10.9 MB (11,421,896 B)dff01364e9c19e8476160c3f079e58f1d85900e19c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
tokenizer_config.json7.1 KB (7,305 B)acee076f49bf3c0298e15de0909d1da7b392f0c3959e7f1d9a1b7641a6d6ce05ca97b75c7894fcb66cbe5a040406458fb1128ee4
vocab.json2.6 MB (2,776,833 B)4783fe10ac3adce15ac8f358ef5462739852c569ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910

Cite this release

Canonical URL
https://aiseedbank.org/models/nomic-ai_nomic-embed-code/
Slug
nomic-ai_nomic-embed-code
Infohash
7bf17f33ccbd059fe56a6d9014e15355f7dcc028
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

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

Provenance

Upstream repositorynomic-ai/nomic-embed-code
Revision (pinned)11114029805cee545ef111d5144b623787462a52
Fetched at2026-09-04T03:20:56Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T03:27:36Z

apache-2.026.35 GB (28,298,425,267 bytes)sentence-transformerssafetensorsqwen2sentence-similarityfeature-extractiontext-embeddings-inferenceendpoints_compatiblepaper: 2412.01007