Model reference · open weights
NV-Embed is an open-weight embedding model from NVIDIA. NV-Embed-v2 (FP16) weighs 15.7 GB; the smallest configuration that runs it is RTX 4090 24 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the nvidia/NV-Embed-v2 model card, 2026-10-01
What it is
| Released by | NVIDIA |
|---|---|
| Released | 2024-08-29 |
| Parameters | 7.9B |
| VRAM | 15.7 GB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB … RTX 4060 Ti 16 GB | does not fit | |
| 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
We present NV-Embed-v2, a generalist embedding model that ranks No. 1 on the Massive Text Embedding Benchmark (MTEB benchmark)(as of Aug 30, 2024) with a score of 72.31 across 56 text embedding tasks. It also holds the No. 1 in the retrieval sub-category (a score of 62.65 across 15 tasks) in the leaderboard, which is essential to the development of RAG technology.
NV-Embed-v2 presents several new designs, including having the LLM attend to latent vectors for better pooled embedding output, and demonstrating a two-staged instruction tuning method to enhance the accuracy of both retrieval and non-retrieval tasks. Additionally, NV-Embed-v2 incorporates a novel hard-negative mining methods that take into account the positive relevance score for better false negatives removal.
For more technical details, refer to our paper: NV-Embed: Improved Techniques for Training LLMs as Generalist Embedding Models.
Here is an example of how to encode queries and passages using Huggingface-transformer and Sentence-transformer. Please find the required package version here.
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
# Each query needs to be accompanied by an corresponding instruction describing the task.
task_name_to_instruct = {"example": "Given a question, retrieve passages that answer the question",}
query_prefix = "Instruct: "+task_name_to_instruct["example"]+"\nQuery: "
queries = [
'are judo throws allowed in wrestling?',
'how to become a radiology technician in michigan?'
]
# No instruction needed for retrieval passages
passage_prefix = ""
passages = [
"Since you're reading this, you are probably someone from a judo background or someone who is just wondering how judo techniques can be applied under wrestling rules. So without further ado, let's get to the question. Are Judo throws allowed in wrestling? Yes, judo throws are allowed in freestyle and folkstyle wrestling. You only need to be careful to follow the slam rules when executing judo throws. In wrestling, a slam is lifting and returning an opponent to the mat with unnecessary force.",
"Below are the basic steps to becoming a radiologic technologist in Michigan:Earn a high school diploma. As with most careers in health care, a high school education is the first step to finding entry-level employment. Taking classes in math and science, such as anatomy, biology, chemistry, physiology, and physics, can help prepare students for their college studies and future careers.Earn an associate degree. Entry-level radiologic positions typically require at least an Associate of Applied Science. Before enrolling in one of these degree programs, students should make sure it has been properly accredited by the Joint Review Committee on Education in Radiologic Technology (JRCERT).Get licensed or certified in the state of Michigan."
]
# load model with tokenizer
model = AutoModel.from_pretrained('nvidia/NV-Embed-v2', trust_remote_code=True)
# get the embeddings
max_length = 32768
query_embeddings = model.encode(queries, instruction=query_prefix, max_length=max_length)
passage_embeddings = model.encode(passages, instruction=passage_prefix, max_length=max_length)
# normalize embeddings
query_embeddings = F.normalize(query_embeddings, p=2, dim=1)
passage_embeddings = F.normalize(passage_embeddings, p=2, dim=1)
# get the embeddings with DataLoader (spliting the datasets into multiple mini-batches)
# batch_size=2
# query_embeddings = model._do_encode(queries, batch_size=batch_size, instruction=query_prefix, max_length=max_length, num_workers=32, return_numpy=True)
# passage_embeddings = model._do_encode(passages, batch_size=batch_size, instruction=passage_prefix, max_length=max_length, num_workers=32, return_numpy=True)
scores = (query_embeddings @ passage_embeddings.T) * 100
print(scores.tolist())
# [[87.42693328857422, 0.46283677220344543], [0.965264618396759, 86.03721618652344]]
import torch
from sentence_transformers import SentenceTransformer
# Each query needs to be accompanied by an corresponding instruction describing the task.
task_name_to_instruct = {"example": "Given a question, retrieve passages that answer the question",}
query_prefix = "Instruct: "+task_name_to_instruct["example"]+"\nQuery: "
queries = [
'are judo throws allowed in wrestling?',
'how to become a radiology technician in michigan?'
]
# No instruction needed for retrieval passages
passages = [
"Since you're reading this, you are probably someone from a judo background or someone who is just wondering how judo techniques can be applied under wrestling rules. So without further ado, let's get to the question. Are Judo throws allowed in wrestling? Yes, judo throws are allowed in freestyle and folkstyle wrestling. You only need to be careful to follow the slam rules when executing judo throws. In wrestling, a slam is lifting and returning an opponent to the mat with unnecessary force.",
"Below are the basic steps to becoming a radiologic technologist in Michigan:Earn a high school diploma. As with most careers in health care, a high school education is the first step to finding entry-level employment. Taking classes in math and science, such as anatomy, biology, chemistry, physiology, and physics, can help prepare students for their college studies and future careers.Earn an associate degree. Entry-level radiologic positions typically require at least an Associate of Applied Science. Before enrolling in one of these degree programs, students shouQuoted 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 | 94.284 |
| Classification | MTEB AmazonCounterfactualClassification (en) | accuracy_stderr | 0.401 |
| Classification | MTEB AmazonCounterfactualClassification (en) | ap | 76.491 |
| Classification | MTEB AmazonCounterfactualClassification (en) | ap_stderr | 1.242 |
| Classification | MTEB AmazonCounterfactualClassification (en) | f1 | 91.420 |
| Classification | MTEB AmazonCounterfactualClassification (en) | f1_stderr | 0.504 |
| Classification | MTEB AmazonCounterfactualClassification (en) | main_score | 94.284 |
| Classification | MTEB AmazonPolarityClassification | accuracy | 97.742 |
| Classification | MTEB AmazonPolarityClassification | accuracy_stderr | 0.074 |
| Classification | MTEB AmazonPolarityClassification | ap | 96.474 |
| Classification | MTEB AmazonPolarityClassification | ap_stderr | 0.298 |
| Classification | MTEB AmazonPolarityClassification | f1 | 97.742 |
| Classification | MTEB AmazonPolarityClassification | f1_stderr | 0.074 |
| Classification | MTEB AmazonPolarityClassification | main_score | 97.742 |
| Classification | MTEB AmazonReviewsClassification (en) | accuracy | 63.960 |
| Classification | MTEB AmazonReviewsClassification (en) | accuracy_stderr | 1.816 |
| Classification | MTEB AmazonReviewsClassification (en) | f1 | 62.494 |
| Classification | MTEB AmazonReviewsClassification (en) | f1_stderr | 2.829 |
| Classification | MTEB AmazonReviewsClassification (en) | main_score | 63.960 |
| Retrieval | MTEB ArguAna | map_at_1 | 46.515 |
| Retrieval | MTEB ArguAna | map_at_10 | 62.392 |
| Retrieval | MTEB ArguAna | map_at_100 | 62.732 |
| Retrieval | MTEB ArguAna | map_at_1000 | 62.733 |
| Retrieval | MTEB ArguAna | map_at_3 | 58.701 |