llama-embed-nemotron-8b is a versatile text embedding model trained by NVIDIA and optimized for retrieval, reranking, semantic similarity, and classification use cases. This model has robust capabilities for multilingual and cross-lingual text retrieval. It is designed to serve as a foundational component in text-based Retrieval-Augmented Generation (RAG) systems.
@misc{babakhin2025llamaembednemotron8buniversaltextembedding,
title={Llama-Embed-Nemotron-8B: A Universal Text Embedding Model for Multilingual and Cross-Lingual Tasks},
author={Yauhen Babakhin and Radek Osmulski and Ronay Ak and Gabriel Moreira and Mengyao Xu and Benedikt Schifferer and Bo Liu and Even Oldridge},
year={2025},
eprint={2511.07025},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2511.07025},
}
The llama-embed-nemotron-8b model is intended for researchers developing applications that need to understand or retrieve information from text. It is well-suited for multilingual RAG systems in which queries and documents are textual and may be in different languages.
Network Architecture: Llama-3.1-8B with bi-directional attention
This model was developed based on meta-llama/Llama-3.1-8B model.
Number of model parameters: 7,504,924,672
This llama-embed-nemotron-8b embedding model is a fine-tuned version of Llama-3.1-8B transformer decoder architecture, with a bidirectional attention mechanism. The model consists of 32 hidden layers and an embedding size of 4096, and trained on public datasets and synthetically generated datasets. Embedding models for text retrieval are typically trained using a bi-encoder architecture. This involves encoding a pair of sentences (for example, query and chunked passages) independently using the embedding model. Contrastive learning is used to maximize the similarity between the query and the passage that contains the answer, while minimizing the similarity between the query and sampled negative passages not useful to answer the question.
Input:
Property
Query
Document
Input Type
Text
Text
Input Format
List of strings
List of strings
Input Parameter
One-Dimensional (1D)
1D
Other Properties
Maximum input sequence length is 32768 tokens.
Maximum input sequence length is 32768 tokens.
Output:
Output Type(s): Floats Output Format: List of floats Output Parameters: One-Dimensional (1D) Other Properties Related to Output: Model outputs embedding vectors of a dimension 4096 for each text input.
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA’s hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
Usage
The llama-embed-nemotron-8b model is instruction-aware, meaning that it supports custom instructions to improve performance for specific use cases or scenarios. In particular, for Retrieval use case, model expects:
Queries accompanied with the task instruction in the following template: f"Instruct: {task_instruction}\nQuery: {query}"
Documents (passages) without any special handling
The model requires transformers version 4.51.0 and flash-attention (for GPU processing)
1from sentence_transformers import SentenceTransformer
23attn_implementation ="eager"# Or "flash_attention_2"4model = SentenceTransformer(5"nvidia/llama-embed-nemotron-8b",6 trust_remote_code=True,7 model_kwargs={"attn_implementation": attn_implementation,"torch_dtype":"bfloat16"},8 tokenizer_kwargs={"padding_side":"left"},9)1011queries =[12"How do neural networks learn patterns from examples?"13]14documents =[15"Deep learning models adjust their weights through backpropagation, using gradient descent to minimize error on training data and improve predictions over time.",16"Market prices are determined by the relationship between how much people want to buy a product and how much is available for sale, with scarcity driving prices up and abundance driving them down.",17]1819# NOTE: encode_query uses the "query" prompt automatically20query_embeddings = model.encode_query(queries)21document_embeddings = model.encode_document(documents)2223scores =(query_embeddings @ document_embeddings.T)2425print(scores.tolist())26# [[0.3770667314529419, 0.05808388814330101]]
Hugging Face Transformers
python
1import torch
2import torch.nn.functional as F
3from transformers import AutoModel, AutoTokenizer
456defaverage_pool(last_hidden_states: torch.Tensor, attention_mask: torch.Tensor)-> torch.Tensor:7"""Average pooling with attention mask."""89 last_hidden_states = last_hidden_states.to(torch.float32)10 last_hidden_states_masked = last_hidden_states.masked_fill(~attention_mask[...,None].bool(),0.0)11 embedding = last_hidden_states_masked.sum(dim=1)/ attention_mask.sum(dim=1)[...,None]12 embedding = F.normalize(embedding, dim=-1)1314return embedding
1516# Define task and queries17defget_instruction(task_instruction:str, query:str)->str:18returnf"Instruct: {task_instruction}\nQuery: {query}"1920model_name_or_path ="nvidia/llama-embed-nemotron-8b"2122attn_implementation ="flash_attention_2"if torch.cuda.is_available()else"eager"2324# Load tokenizer25tokenizer = AutoTokenizer.from_pretrained(26 model_name_or_path,27 trust_remote_code=True,28 padding_side="left",29)3031# Load model32model = AutoModel.from_pretrained(33 model_name_or_path,34 trust_remote_code=True,35 torch_dtype=torch.float16,36 attn_implementation=attn_implementation,37).eval()38model = model.to("cuda:0"if torch.cuda.is_available()else"cpu")3940# Model is instruction-aware, which requires each query to have a short instruction with the task instruction41task ="Given a question, retrieve passages that answer the question"42queries =[43 get_instruction(task,"How do neural networks learn patterns from examples?"),44]4546# No instruction is required for documents corpus47documents =[48"Deep learning models adjust their weights through backpropagation, using gradient descent to minimize error on training data and improve predictions over time.",49"Market prices are determined by the relationship between how much people want to buy a product and how much is available for sale, with scarcity driving prices up and abundance driving them down.",50]51input_texts = queries + documents
5253# Tokenize the input texts54batch_dict = tokenizer(55 text=input_texts,56 max_length=4096,57 padding=True,58 truncation=True,59 return_tensors="pt",60).to(model.device)61attention_mask = batch_dict["attention_mask"]6263# Forward pass64model_outputs = model(**batch_dict)6566# Average pooling67embeddings = average_pool(model_outputs.last_hidden_state, attention_mask)6869scores =(embeddings[:1] @ embeddings[1:].T)7071print(scores.tolist())72# [[0.37644022703170776, 0.05794818699359894]]
If you already have a local copy of the model, you can also pass the local
path instead of the HF repo ID.
Optional flags:
--dtype <float32|bfloat16|float16> to force precision (the default is auto, which resolves from model config; this model defaults to BF16).
--data-parallel-size <num_gpus_to_use> for multi-GPU serving.
--port 8000 to set the server port.
Online serving example (OpenAI SDK):
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="EMPTY", # required by OpenAI SDK; ignored by default in local vLLM
)
response = client.embeddings.create(
input=['Instruct: Given a question, retrieve passages that answer the question\nQuery: summit define'],
model="nvidia/llama-embed-nemotron-8b",
)
response.data[0].embedding
Offline inference example (Python API, no server required):
from vllm import LLM
llm = LLM(
model="nvidia/llama-embed-nemotron-8b",
runner="pooling",
trust_remote_code=True,
)
outputs = llm.embed(["Instruct: Given a question, retrieve passages that answer the question\nQuery: summit define", "a summit is a meeting"])
for output in outputs:
print(len(output.outputs.embedding))
The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment. This AI model can be embedded as an Application Programming Interface (API) call into the software environment described above.
Model Version(s):
llama-embed-nemotron-8b-v1
Training and Testing Datasets
Training Dataset:
Data Modality
Text
Text Training Data Size
1 Billion to 10 Trillion Tokens
Data Collection Method by dataset
Hybrid: Human, Automated, Synthetic
Labeling Method by dataset
Hybrid: Human, Automated, Synthetic
Properties: 16.4M query-passage pairs from public and synthetically generated datasets.
Below we present results for MTEB(Multilingual, v2) split of MMTEB benchmark (as of October 21, 2025). Ranking on MMTEB Leaderboards is performed based on the Borda rank. Each task is treated as a preference voter, which gives votes on the models per their relative performance on the task. The best model obtains the highest number of votes. The model with the highest number of votes across tasks obtains the highest rank. The Borda rank tends to prefer models that perform well broadly across tasks.
Borda Rank
Model
Borda Votes
Mean (Task)
1.
llama-embed-nemotron-8b
39,573
69.46
2.
gemini-embedding-001
39,368
68.37
3.
Qwen3-Embedding-8B
39,364
70.58
4.
Qwen3-Embedding-4B
39,099
69.45
5.
Qwen3-Embedding-0.6B
37,419
64.34
6.
gte-Qwen2-7B-instruct
37,167
62.51
7.
Linq-Embed-Mistral
37,149
61.47
Data Collection Method by dataset:
Hybrid: Automated, Human, Synthetic
Labeling Method by dataset:
Hybrid: Automated, Human, Synthetic
Properties: More details about MMTEB benchmark can be found on their leaderboard or in their published paper.
Inference:
Acceleration Engine: GPU Test Hardware: A100 80GB, H100 80GB
Ethical Considerations:
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns here.