Model reference · open weights
modernbert-embed-large is an open-weight embedding model from lightonai. modernbert-embed-large (FP32) weighs 790 MB; the smallest configuration that runs it is RTX 3060 12 GB.
Summary of the lightonai/modernbert-embed-large model card, 2026-10-01
What it is
| Released by | lightonai |
|---|---|
| Released | 2025-01-13 |
| Parameters | 395M |
| VRAM | 790 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-large is an embedding model trained from ModernBERT-large, bringing the new advances of ModernBERT to embeddings!
Indeed, ModernBERT is a base model trained for Masked Language Modeling and can not directly be used to perform tasks such as retrieval without further fine-tuning.
ModernBERT-embed-large is fine-tuned on the Nomic Embed weakly-supervised and supervised datasets and also supports Matryoshka Representation Learning dimensions of 256 to reduce memory 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.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 |
| modernbert-embed-large | 1024 | 63,84 | 75.03 | 46.04 | 85.31 | 57.64 | 54.36 | 83.80 | 28.31 |
| 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 |
| modernbert-embed-large | 256 | 62.43 | 73.60 | 44.59 | 84.89 | 57.08 | 51.72 | 83.46 | 29.03 |
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("lightonai/modernbert-embed-large")
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, 1024) (1, 1024)
similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
# tensor([[0.6518],
# [0.4237]])
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("lightonai/modernbert-embed-large", 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.6835],
# [0.3982]])
Note the small differences compared to the full 1024-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("lightonai/modernbert-embed-large")
model = AutoModel.from_pretrained("lightonai/modernbert-embed-large")
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, 1024]) torch.Size([1, 1024])
similarities = query_embeddings @ doc_embeddings.T
print(similarities)
# tensor([[0.6518],
# [0.4237]])
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_pooQuoted 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 | 76.791 |
| Classification | MTEB AmazonCounterfactualClassification (en) | ap | 39.796 |
| Classification | MTEB AmazonCounterfactualClassification (en) | f1 | 70.696 |
| Classification | MTEB AmazonPolarityClassification | accuracy | 94.195 |
| Classification | MTEB AmazonPolarityClassification | ap | 91.751 |
| Classification | MTEB AmazonPolarityClassification | f1 | 94.192 |
| Classification | MTEB AmazonReviewsClassification (en) | accuracy | 47.664 |
| Classification | MTEB AmazonReviewsClassification (en) | f1 | 46.933 |
| Retrieval | MTEB ArguAna | map_at_1 | 25.178 |
| Retrieval | MTEB ArguAna | map_at_10 | 41.088 |
| Retrieval | MTEB ArguAna | map_at_100 | 42.143 |
| Retrieval | MTEB ArguAna | map_at_1000 | 42.152 |
| Retrieval | MTEB ArguAna | map_at_20 | 41.946 |
| Retrieval | MTEB ArguAna | map_at_3 | 36.048 |
| Retrieval | MTEB ArguAna | map_at_5 | 38.619 |
| Retrieval | MTEB ArguAna | mrr_at_1 | 25.533 |
| Retrieval | MTEB ArguAna | mrr_at_10 | 41.238 |
| Retrieval | MTEB ArguAna | mrr_at_100 | 42.293 |
| Retrieval | MTEB ArguAna | mrr_at_1000 | 42.302 |
| Retrieval | MTEB ArguAna | mrr_at_20 | 42.096 |
| Retrieval | MTEB ArguAna | mrr_at_3 | 36.261 |
| Retrieval | MTEB ArguAna | mrr_at_5 | 38.797 |
| Retrieval | MTEB ArguAna | ndcg_at_1 | 25.178 |
| Retrieval | MTEB ArguAna | ndcg_at_10 | 50.352 |