Model reference · open weights
modernbert-embed is an open-weight embedding model from nomic-ai. modernbert-embed-base (FP32) weighs 298 MB; the smallest configuration that runs it is RTX 3060 12 GB.
Summary of the nomic-ai/modernbert-embed-base model card, 2026-10-01
What it is
| Released by | nomic-ai |
|---|---|
| Released | 2024-12-29 |
| Parameters | 149M |
| VRAM | 298 MB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB | fits | 11.6 GB |
| RTX 4060 Ti 16 GB | fits | 15.4 GB |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
From the model card
ModernBERT Embed is an embedding model trained from ModernBERT-base, bringing the new advances of ModernBERT to embeddings!
Trained on the Nomic Embed weakly-supervised and supervised datasets, modernbert-embed also supports Matryoshka Representation Learning dimensions of 256, reducing memory by 3x with minimal performance loss.
| Model | Dimensions | Average (56) | Classification (12) | Clustering (11) | Pair Classification (3) | Reranking (4) | Retrieval (15) | STS (10) | Summarization (1) |
|---|---|---|---|---|---|---|---|---|---|
| nomic-embed-text-v1 | 768 | 62.4 | 74.1 | 43.9 | 85.2 | 55.7 | 52.8 | 82.1 | 30.1 |
| nomic-embed-text-v1.5 | 768 | 62.28 | 73.55 | 43.93 | 84.61 | 55.78 | 53.01 | 81.94 | 30.4 |
| modernbert-embed-base | 768 | 62.62 | 74.31 | 44.98 | 83.96 | 56.42 | 52.89 | 81.78 | 31.39 |
| nomic-embed-text-v1.5 | 256 | 61.04 | 72.1 | 43.16 | 84.09 | 55.18 | 50.81 | 81.34 | 30.05 |
| modernbert-embed-base | 256 | 61.17 | 72.40 | 43.82 | 83.45 | 55.69 | 50.62 | 81.12 | 31.27 |
You can use these models directly with the latest transformers release and requires installing transformers>=4.48.0:
pip install transformers>=4.48.0
Reminder, this model is trained similarly to Nomic Embed and REQUIRES prefixes to be added to the input. For more information, see the instructions in Nomic Embed.
Most use cases, adding search_query: to the query and search_document: to the documents will be sufficient.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("nomic-ai/modernbert-embed-base")
query_embeddings = model.encode([
"search_query: What is TSNE?",
"search_query: Who is Laurens van der Maaten?",
])
doc_embeddings = model.encode([
"search_document: TSNE is a dimensionality reduction algorithm created by Laurens van Der Maaten",
])
print(query_embeddings.shape, doc_embeddings.shape)
# (2, 768) (1, 768)
similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
# tensor([[0.7214],
# [0.3260]])
In Sentence Transformers, you can truncate embeddings to a smaller dimension by using the truncate_dim parameter when loading the SentenceTransformer model.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("nomic-ai/modernbert-embed-base", truncate_dim=256)
query_embeddings = model.encode([
"search_query: What is TSNE?",
"search_query: Who is Laurens van der Maaten?",
])
doc_embeddings = model.encode([
"search_document: TSNE is a dimensionality reduction algorithm created by Laurens van Der Maaten",
])
print(query_embeddings.shape, doc_embeddings.shape)
# (2, 256) (1, 256)
similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
# tensor([[0.7759],
# [0.3419]])
Note the small differences compared to the full 768-dimensional similarities.
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0]
input_mask_expanded = (
attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
)
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(
input_mask_expanded.sum(1), min=1e-9
)
queries = ["search_query: What is TSNE?", "search_query: Who is Laurens van der Maaten?"]
documents = ["search_document: TSNE is a dimensionality reduction algorithm created by Laurens van Der Maaten"]
tokenizer = AutoTokenizer.from_pretrained("nomic-ai/modernbert-embed-base")
model = AutoModel.from_pretrained("nomic-ai/modernbert-embed-base")
encoded_queries = tokenizer(queries, padding=True, truncation=True, return_tensors="pt")
encoded_documents = tokenizer(documents, padding=True, truncation=True, return_tensors="pt")
with torch.no_grad():
queries_outputs = model(**encoded_queries)
documents_outputs = model(**encoded_documents)
query_embeddings = mean_pooling(queries_outputs, encoded_queries["attention_mask"])
query_embeddings = F.normalize(query_embeddings, p=2, dim=1)
doc_embeddings = mean_pooling(documents_outputs, encoded_documents["attention_mask"])
doc_embeddings = F.normalize(doc_embeddings, p=2, dim=1)
print(query_embeddings.shape, doc_embeddings.shape)
# torch.Size([2, 768]) torch.Size([1, 768])
similarities = query_embeddings @ doc_embeddings.T
print(similarities)
# tensor([[0.7214],
# [0.3260]])
In transformers, you can truncate embeddings to a smaller dimension by slicing the mean pooled embeddings, prior to normalization.
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0]
input_mask_expanded = (
attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
)
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(
input_mask_expanded.sum(1), min=1e-9
)Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.
Benchmarks
As published on the model card: the maker's own numbers, not measured by AxForge.
| Task | Dataset | Metric | Score |
|---|---|---|---|
| Classification | MTEB AmazonCounterfactualClassification (en) | accuracy | 78.134 |
| Classification | MTEB AmazonCounterfactualClassification (en) | ap | 42.190 |
| Classification | MTEB AmazonCounterfactualClassification (en) | f1 | 72.344 |
| Classification | MTEB AmazonPolarityClassification | accuracy | 93.094 |
| Classification | MTEB AmazonPolarityClassification | ap | 90.037 |
| Classification | MTEB AmazonPolarityClassification | f1 | 93.087 |
| Classification | MTEB AmazonReviewsClassification (en) | accuracy | 48.428 |
| Classification | MTEB AmazonReviewsClassification (en) | f1 | 47.743 |
| Retrieval | MTEB ArguAna | map_at_1 | 23.898 |
| Retrieval | MTEB ArguAna | map_at_10 | 39.775 |
| Retrieval | MTEB ArguAna | map_at_100 | 40.827 |
| Retrieval | MTEB ArguAna | map_at_1000 | 40.837 |
| Retrieval | MTEB ArguAna | map_at_20 | 40.604 |
| Retrieval | MTEB ArguAna | map_at_3 | 34.519 |
| Retrieval | MTEB ArguAna | map_at_5 | 37.307 |
| Retrieval | MTEB ArguAna | mrr_at_1 | 24.395 |
| Retrieval | MTEB ArguAna | mrr_at_10 | 39.963 |
| Retrieval | MTEB ArguAna | mrr_at_100 | 41.014 |
| Retrieval | MTEB ArguAna | mrr_at_1000 | 41.024 |
| Retrieval | MTEB ArguAna | mrr_at_20 | 40.791 |
| Retrieval | MTEB ArguAna | mrr_at_3 | 34.732 |
| Retrieval | MTEB ArguAna | mrr_at_5 | 37.481 |
| Retrieval | MTEB ArguAna | ndcg_at_1 | 23.898 |
| Retrieval | MTEB ArguAna | ndcg_at_10 | 48.962 |