alt.freeweights.embed / nomic-embed-code
From: nomic-ai <huggingface.co/nomic-ai>Newsgroups: alt.freeweights.embedSubject:

nomic-embed-code

Date: 2026-11-14Commit: 1111402Signed: 2DC28CC7B26A283B ✓

Sentence similarity model with 7.1B parameters. Safetensors weights, 28.3 GB in all. Published by nomic-ai under Apache-2.0.

7.1B params28.3GBnomic-embed-codesafetensorspermissive
FactsParams7.1BSize28.3 GBFormatssafetensorsTasksentence similarityLicenseApache-2.0From sourcepermissive
$ fw get nomic-ai/nomic-embed-code
# manifest sha256 23c9511d635e… · 28.3 GB · 20 files
$ fw verify ./nomic-embed-code nomic-ai/nomic-embed-code
From sourceHosted (signed)nomic-ai/nomic-embed-codeLast check: 2026-11-14 21:10 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Fine-tune of Qwen2.5-Coder-7B-Instruct.

Works with

Evaluate with

Overview

Size
28.3 GB
Weights
28.3 GB (safetensors)
Parameters
7.1B
Formats
safetensors
Task
sentence similarity
License
Apache-2.0 (permissive)
Files
20, each with a sha256
Publisher
nomic-ai
Added
2026-11-14
Section
alt.freeweights.embed
Lineage

Original release from the publisher.

Base model: Qwen/Qwen2.5-Coder-7B-Instruct

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:10 UTCpassed

Model card

From the publisher at commit 1111402. Shown as plain text with links; images open at the publisher.

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
ModelPythonJavaRubyPHPJavaScriptGo
Nomic Embed Code81.780.581.872.377.193.8
Voyage Code 380.880.584.671.779.293.2
OpenAI Embed 3 Large70.872.975.359.668.187.6
Nomic CodeRankEmbed-137M78.476.979.368.871.492.7
CodeSage Large v2 (1B)74.272.376.765.272.584.6
CodeSage Large (1B)70.870.271.961.369.583.7
Qodo Embed 1 7B59.961.668.448.557.081.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.

Image: image/png

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#

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}, 
}

Files

20 files · 28.3 GBWeights 28.3 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 20 files with their sha256
FileSizesha256
.gitattributes1.57 KB34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930
1_Pooling/config.json297 B94272b648336b99f82b04e165ddc8efb8476a21ded0ce2d2ab6deaf511f292de
README.md5.84 KB7a044c742bfa76547c5eb91106e04c20c71bcb3fcf871cfcfec4938a622ca986
added_tokens.json605 B58b54bbe36fc752f79a24a271ef66a0a0830054b4dfad94bde757d851968060b
config.json704 B245287b1c81bdf4ce9223671a612146d842268f76ced85623e711061df581b6f
config_sentence_transformers.json274 Be26fdbd3f969e63d3fff779a1333f12c28b272a40e9841e7677b756b57ee8af2
merges.txt1.67 MB8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
model-00001-of-00006.safetensors4.98 GBe33053439bc99e1fdc72a0ad6d9f0bae0b9afc84c34b51e0e8986dd769359eda
model-00002-of-00006.safetensors4.78 GBa3ada145dd42a034de6267ad12d2cc02043b1bc41738590094ace97ed261e457
model-00003-of-00006.safetensors4.93 GBd395d51ea31cd5b1551f9c15e836709f01f6af542d62089f06b7c06e709da0ff
model-00004-of-00006.safetensors4.93 GB9090fd22409a92917dc4e14540979574c7aeaf2bac12e51402f8983d1536e4d1
model-00005-of-00006.safetensors5.00 GB4f212fd19c01b5e928fd5780257b2e4c9d617f4c3f5733294570eda2dcbe9972
model-00006-of-00006.safetensors3.66 GBb2742bab0012d717fda6e18f7efff1146f8e7f44d678dc04cac83bddca0331e8
model.safetensors.index.json25.7 KB945bc6c92ec7806e08a4595768a78f4d28f17ff9dc82b22d8a65486bd86ade8b
modules.json349 B84e40c8e006c9b1d6c122e02cba9b02458120b5fb0c87b746c41e0207cf642cf
sentence_bert_config.json55 B1140b92d307aec9383d897169c9f489f3a568787b80bf760f5d7cc9d25169a65
special_tokens_map.json613 B76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
tokenizer.json11.4 MB9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
tokenizer_config.json7.30 KB959e7f1d9a1b7641a6d6ce05ca97b75c7894fcb66cbe5a040406458fb1128ee4
vocab.json2.78 MBca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
1111402980 pinned now manifest updated, same commit2026-11-14 21:10 UTC20 files · 28.3 GB
11114029802026-11-14 21:10 UTC20 files · 28.3 GB

Use it

$ fw get nomic-ai/nomic-embed-code
# manifest sha256 23c9511d635e… · 28.3 GB · 20 files
$ fw verify ./nomic-embed-code nomic-ai/nomic-embed-code
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/nomic-ai/nomic-embed-code.json --dir ./nomic-embed-code $ python3 fw.py verify ./nomic-embed-code ./nomic-ai__nomic-embed-code.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download nomic-ai/nomic-embed-code --revision 11114029805cee545ef111d5144b623787462a52 --local-dir ./nomic-embed-code
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("nomic-ai/nomic-embed-code", revision="11114029805cee545ef111d5144b623787462a52") model = AutoModel.from_pretrained("nomic-ai/nomic-embed-code", revision="11114029805cee545ef111d5144b623787462a52", device_map="auto")
sentence-transformersEmbed text with sentence-transformers.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from sentence_transformers import SentenceTransformer model = SentenceTransformer("nomic-ai/nomic-embed-code", revision="11114029805cee545ef111d5144b623787462a52") vectors = model.encode(["Hello"])

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
7a044c742bfa76547c5eb91106e04c20c71bcb3fcf871cfcfec4938a622ca986
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: nomic-ai <huggingface.co/nomic-ai>Newsgroups: alt.freeweights.embedSubject: nomic-embed-codeDate: 2026-11-14Commit: 1111402Signed: 2DC28CC7B26A283B ✓
Upstream
nomic-ai/nomic-embed-code
Pinned commit
11114029805cee545ef111d5144b623787462a52
Manifest
nomic-embed-code.json · .minisig
Manifest sha256
23c9511d635e550670fceedb256d014c10c0f5f7fb8ae522521cc37afbb27627
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:10 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/nomic-ai/nomic-embed-code.json $ curl -O https://freeweights.allternit.com/manifests/nomic-ai/nomic-embed-code.json.minisig $ minisign -Vm nomic-embed-code.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

Parent

Qwen/Qwen2.5-Coder-7B-Instruct · this model is a finetune of it

3 models in the catalog name this one as their parent.

Quantizations
3
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download nomic-ai/nomic-embed-code
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. nomic-embed-code.json. Provenance. Takedown history: none.

Variants

3 quantized or adapter builds of nomic-embed-code. Each has its own license check and page.

From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-MiniLM-L6-v1
From: unsloth <huggingface.co/unsloth>Subject: all-MiniLM-L6-v2
From: mlx-community <huggingface.co/mlx-community>Subject: all-MiniLM-L6-v2-4bit
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-mpnet-base-v1
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: allenai-specter
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: bert-base-nli-max-tokens