llama-nemotron-rerank-vl-1b-v2 由 NVIDIA 开发,用于多模态问答检索。它经过优化,可提供表示文档页面与给定查询相关性的 logit 分数。该模型能够处理图像、文本或图像与文本组合形式的文档。预期的图像为文档页面或幻灯片的截图。系统会根据用户的文本查询对文档进行排序。该模型支持包含文本、表格、图表和信息图的图像。我们通过在主流的 ViDoRe V1、V2 以及新的 Vidore V3(详情参见 Vidore LB)多模态检索基准测试,以及两个内部整理的视觉检索数据集上对模型进行评估,来报告其性能。
重排序模型是多模态检索系统(如视觉 RAG 管道)的关键组件,有助于提高整体准确性。多模态检索系统通常使用多模态嵌入模型(密集型)根据输入返回相关文档。重排序模型可用于将潜在候选文档重新排序为最终顺序。重排序模型将查询和文档对作为输入,其自注意力机制能够在它们的标记之间进行更深层次的交互。将排序模型应用于知识库中与特定查询相关的所有文档并不具备可扩展性;因此,排序模型通常用于对嵌入模型检索到的顶级候选文档进行重排序。
该模型已准备好投入商业使用。
llama-nemotron-rerank-vl-1b-v2 最适合希望利用最新的密集检索技术,在大型语料库上构建多模态问答应用的用户。
本模型的使用受 NVIDIA Open Model License Agreement 管辖,后处理脚本的使用受 Apache 2.0 许可。 其他信息:Llama 3.2 Community Model License Agreement。基于 Llama 构建。
2025年12月18日,通过 https://huggingface.co/nvidia/llama-nemotron-rerank-vl-1b-v2
架构类型: Transformer
网络架构: Eagle VLM 架构,包含 SigLIP 2 400M 视觉编码器和 llama-nemotron-rerank-1b-v2 模型作为语言模型。
llama-nemotron-rerank-vl-1b-v2 是一个交叉编码器模型,拥有约 17 亿参数。它是 NVIDIA Eagle 系列模型的微调版本,由 SigLIP 2 400M 视觉编码器和 Llama 3.2 1B 语言模型组成。解码器输出的最终嵌入采用均值池化策略进行聚合,并针对排序任务微调了一个二元分类头。模型使用交叉熵损失来最大化包含回答问题所需信息的(视觉)文档的可能性,同时最小化不包含回答问题所需信息的(负例)文档的可能性。
该视觉语言模型重排序器融合了 NVIDIA 的关键创新技术,包括采用基于分块(tiling)的 VLM 架构的 Eagle 2 研究成果,以及 nemoretriever-parse。Eagle 2 架构可在 Hugging Face 获取,其动态分块和混合视觉编码器设计显著增强了多模态理解能力,尤其在涉及高分辨率图像和复杂视觉内容的任务上表现出色。
输入类型: 图像、文本
输入格式:
输入参数:
与输入相关的其他属性:
该模型仅在图像数据上进行了微调,使用 max_input_tiles = 4,最大上下文长度为 2048 个令牌。在评估时,它在仅图像、图像+文本以及仅文本输入上进行了测试,使用 max_input_tiles = 6,最大上下文长度为 10240 个令牌。超过最大长度的输入将被截断。
输出类型: 浮点数
输出格式: 浮点数列表
输出参数: 一维
与输出相关的其他属性: 每个值对应一个原始 logit。用户在使用模型时,可以选择对 logit 应用 Sigmoid 激活函数,将其转换为概率。
我们的 AI 模型经过设计和/或优化,可在 NVIDIA GPU 加速系统上运行。通过利用 NVIDIA 的硬件(例如 GPU 核心)和软件框架(例如 CUDA 库),与仅使用 CPU 的解决方案相比,该模型实现了更快的训练和推理时间。
该模型需要 transformers 版本 >= 4.56.0,也可选择安装 flash-attention。
pip install "transformers>=4.56.0"
pip install "flash-attn>=2.6.3,<2.8" --no-build-isolation
安装 Sentence Transformers:
pip install sentence_transformersfrom sentence_transformers import CrossEncoder
from transformers.image_utils import load_image
model = CrossEncoder("nvidia/llama-nemotron-rerank-vl-1b-v2", trust_remote_code=True)
query = "How is AI improving the intelligence and capabilities of robots?"
documents = [
"AI enables robots to perceive, plan, and act autonomously.",
"AI is transforming autonomous vehicles by enabling safer, smarter, and more reliable decision-making on the road.",
"A biological foundation model designed to analyze and generate DNA, RNA, and protein sequences.",
]
images = [
load_image("https://developer.download.nvidia.com/images/isaac/nvidia-isaac-lab-1920x1080.jpg"),
load_image("https://blogs.nvidia.com/wp-content/uploads/2018/01/automotive-key-visual-corp-blog-level4-av-og-1280x680-1.png"),
load_image("https://developer-blogs.nvidia.com/wp-content/uploads/2025/02/hc-press-evo2-nim-25-featured-b.jpg"),
]
# Text-only reranking
pairs = [(query, doc) for doc in documents]
scores = model.predict(pairs)
print(scores)
# [-0.738 -3.859 -7.75 ]
rankings = model.rank(query, documents)
print(rankings)
# [{'corpus_id': 0, 'score': -0.73828125}, {'corpus_id': 1, 'score': -3.859375}, {'corpus_id': 2, 'score': -7.75}]
# Image-only reranking
pairs = [(query, img) for img in images]
scores = model.predict(pairs)
print(scores)
# [-4.125 -5.156 -5.969]
rankings = model.rank(query, images)
print(rankings)
# [{'corpus_id': 0, 'score': -4.125}, {'corpus_id': 1, 'score': -5.15625}, {'corpus_id': 2, 'score': -5.96875}]
# Image+text reranking
multimodal_docs = [{"image": img, "text": doc} for img, doc in zip(images, documents)]
pairs = [(query, doc) for doc in multimodal_docs]
scores = model.predict(pairs)
print(scores)
# [-2.594 -4.531 -6.219]
rankings = model.rank(query, multimodal_docs)
print(rankings)
# [{'corpus_id': 0, 'score': -2.59375}, {'corpus_id': 1, 'score': -4.53125}, {'corpus_id': 2, 'score': -6.21875}]import torch
from transformers import AutoModelForSequenceClassification, AutoProcessor
from transformers.image_utils import load_image
modality = "image"
# Load model
model_path = "nvidia/llama-nemotron-rerank-vl-1b-v2"
device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForSequenceClassification.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
attn_implementation="flash_attention_2",
device_map="auto"
).eval()
# Build processor kwargs (base settings)
processor_kwargs = {
"trust_remote_code": True,
"max_input_tiles": 6,
"use_thumbnail": True
}
# Set rerank_max_length based on modality
if modality == "image":
processor_kwargs["rerank_max_length"] = 2048
elif modality == "image_text":
processor_kwargs["rerank_max_length"] = 10240
elif modality == "text":
processor_kwargs["rerank_max_length"] = 8192
# Load processor with modality-specific kwargs
processor = AutoProcessor.from_pretrained(
model_path,
**processor_kwargs
)
query = "How is AI improving the intelligence and capabilities of robots?"
image_paths = [
"https://developer.download.nvidia.com/images/isaac/nvidia-isaac-lab-1920x1080.jpg",
"https://blogs.nvidia.com/wp-content/uploads/2018/01/automotive-key-visual-corp-blog-level4-av-og-1280x680-1.png",
"https://developer-blogs.nvidia.com/wp-content/uploads/2025/02/hc-press-evo2-nim-25-featured-b.jpg"
]
# Load all images
images = [load_image(img_path) for img_path in image_paths]
# Text descriptions corresponding to each image/document
document_texts = [
"AI enables robots to perceive, plan, and act autonomously.",
"AI is transforming autonomous vehicles by enabling safer, smarter, and more reliable decision-making on the road.",
"A biological foundation model designed to analyze and generate DNA, RNA, and protein sequences.",
]
if modality == "image":
# Prepare inputs: same query, different images
examples = [{
"question": query,
"doc_text": "",
"doc_image": image
} for image in images]
elif modality == "image_text":
examples = [{
"question": query,
"doc_text": doc_text,
"doc_image": image
} for image, doc_text in zip(images, document_texts)]
elif modality == "text":
# Prepare inputs: same query, different texts
examples = [{
"question": query,
"doc_text": doc_text,
"doc_image": ""
} for doc_text in document_texts]
else:
raise ValueError(f"Invalid modality: {modality}. Must be 'image', 'image_text', or 'text'")
# Process with processor
batch_dict = processor.process_queries_documents_crossencoder(examples)
# Move to device
batch_dict = {
k: v.to(device) if isinstance(v, torch.Tensor) else v
for k, v in batch_dict.items()
}
# Run inference
with torch.no_grad():
outputs = model(**batch_dict, return_dict=True)
# Get logits
logits = outputs.logits
logits_flat = logits.squeeze(-1)
# Get sorted indices (highest to lowest)
sorted_indices = torch.argsort(logits_flat, descending=True)
print(f"\nRanking (highest to lowest relevance for the modality {modality}):")
for rank, idx in enumerate(sorted_indices, 1):
doc_idx = idx.item()
logit_val = logits_flat[doc_idx].item()
if modality == "text":
print(f" Rank {rank}: logit={logit_val:.4f} | Text: {document_texts[doc_idx]}")
else: # image or image_text modality
print(f" Rank {rank}: logit={logit_val:.4f} | Image: {image_paths[doc_idx]}")
该模型可通过vLLM进行部署,以实现高吞吐量的评分和重排序。必须通过--chat-template提供评分模板,以正确格式化查询-文档对——如果没有该模板,提示词模板将不会被应用,导致结果错误。
有关完整详情,请参阅vLLM 文档。
创建评分模板文件并启动服务器:
cat > nemotron-vl-rerank.jinja << 'JINJA'
{%- set query_msg = (messages | selectattr('role', 'equalto', 'query') | list | first) -%}
{%- set doc_msg = (messages | selectattr('role', 'equalto', 'document') | list | first) -%}
{%- set q = query_msg['content'] -%}
{%- set d = doc_msg['content'] -%}
{%- set has_image = ("<image>" in d) -%}
{%- set d_clean = d | replace("<image>", "") -%}
{%- set q_clean = q | replace("<image>", "") -%}
{%- if has_image -%}<image>{{ " " }}{%- endif -%}
question:{{ q_clean }}{{ " " }}
{{ " " }}
{{ " " }}passage:{{ d_clean }}
JINJA
vllm serve nvidia/llama-nemotron-rerank-vl-1b-v2 \
--runner pooling \
--trust-remote-code \
--max-model-len 10240 \
--chat-template nemotron-vl-rerank.jinja注意:使用 --max-model-len 10240 以支持包括图像+文本在内的所有模态。如果仅处理纯图像文档,可以使用较小的值,如 2048。
发送重排序请求:
import requests
url = "http://localhost:8000/rerank"
# Text-only reranking
response = requests.post(url, json={
"model": "nvidia/llama-nemotron-rerank-vl-1b-v2",
"query": "How is AI improving the intelligence and capabilities of robots?",
"documents": [
"AI enables robots to perceive, plan, and act autonomously.",
"A biological foundation model designed to analyze DNA, RNA, and protein sequences.",
],
})
print(response.json())
# Image document reranking
response = requests.post(url, json={
"model": "nvidia/llama-nemotron-rerank-vl-1b-v2",
"query": "How is AI improving the intelligence and capabilities of robots?",
"documents": [
{"content": [{"type": "image_url", "image_url": {"url": "https://example.com/page.png"}}]},
{"content": [
{"type": "text", "text": "AI enables robots to perceive, plan, and act autonomously."},
{"type": "image_url", "image_url": {"url": "https://example.com/page2.png"}},
]},
],
})
print(response.json())from vllm import LLM
SCORE_TEMPLATE = """\
{%- set query_msg = (messages | selectattr('role', 'equalto', 'query') | list | first) -%}
{%- set doc_msg = (messages | selectattr('role', 'equalto', 'document') | list | first) -%}
{%- set q = query_msg['content'] -%}
{%- set d = doc_msg['content'] -%}
{%- set has_image = ("<image>" in d) -%}
{%- set d_clean = d | replace("<image>", "") -%}
{%- set q_clean = q | replace("<image>", "") -%}
{%- if has_image -%}<image>{{ " " }}{%- endif -%}
question:{{ q_clean }}{{ " " }}
{{ " " }}
{{ " " }}passage:{{ d_clean }}"""
llm = LLM(
model="nvidia/llama-nemotron-rerank-vl-1b-v2",
runner="pooling",
max_model_len=10240,
trust_remote_code=True,
)
query = "How is AI improving the intelligence and capabilities of robots?"
documents = [
"AI enables robots to perceive, plan, and act autonomously.",
"A biological foundation model designed to analyze DNA, RNA, and protein sequences.",
]
# Text-only scoring
outputs = llm.score(query, documents, chat_template=SCORE_TEMPLATE)
for doc, output in zip(documents, outputs):
print(f"Score: {output.outputs.score:.4f} | {doc}")
# Image document scoring
outputs = llm.score(
query,
[
{"content": [{"type": "image_url", "image_url": {"url": "https://example.com/page.png"}}]},
{"content": [
{"type": "text", "text": "AI enables robots to perceive, plan, and act autonomously."},
{"type": "image_url", "image_url": {"url": "https://example.com/page2.png"}},
]},
],
chat_template=SCORE_TEMPLATE,
)
for output in outputs:
print(f"Score: {output.outputs.score:.4f}")运行时引擎:
支持的硬件微架构兼容性: NVIDIA Ampere、NVIDIA Hopper、NVIDIA Lovelace、NVIDIA Blackwell
推荐/支持的操作系统: Linux
要将基础模型和微调模型集成到 AI 系统中,需要使用特定用例的数据进行额外测试,以确保安全有效的部署。遵循 V 模型方法,在单元和系统层面进行迭代测试和验证至关重要,这有助于在部署前降低风险、满足技术和功能要求,并确保符合安全和道德标准。
llama-nemotron-rerank-vl-1b-v2
大规模公共开放问答数据集的发展,极大地推动了强大的视觉语言模型以及视觉嵌入和重排序模型的进步。然而,以下问题限制了这些模型在商业环境中的使用:
NVIDIA 的训练数据集基于公共问答数据集,并且仅包含具有商业应用许可的数据集。
特性: 该模型使用公开可用的图像数据集进行了微调。我们还为图像语料库生成了合成查询,其原始查询是使用专有模型生成的。
数据模态
图像训练数据量
数据集的数据收集方法 混合:自动化、人工、合成
数据集的标注方法: 混合:自动化、人工、合成
我们在一组评估基准上对嵌入 + 重排序管道进行了评估。我们将排序模型应用于从 llama-nemotron-embed-vl-1b-v2 模型检索到的候选结果。
视觉文档检索基准
我们在五个不同的视觉文档检索数据集上对 llama-nemotron-rerank-vl-1b-v2 进行了评估:流行的 ViDoRe V1、V2,新的 Vidore V3,以及两个内部视觉文档检索数据集:
对于有兴趣复现我们结果的用户,可以通过 NeMo Retriever Extraction GitHub 仓库中的此 notebook 中的说明创建我们的一个内部数据集(DigitalCorpora-10k)。
文本检索基准
我们在 92 个文本检索数据集上对 llama-nemotron-rerank-vl-1b-v2 进行了评估,这些数据集来自 BEIR、MIRACL(多语言)、MLQA(跨语言)和 MLDR(长上下文)基准。
在本节中,我们报告 llama-nemotron-rerank-vl-1b-v2 在不同输入模态下的性能。从下表中可以看出,与 VLM 嵌入基线相比,VLM 重排序模型在 5 个评估数据集上,text 模态的平均 Recall@5 提升约 7.2%,image 模态提升约 6.9%,image + text 模态提升约 6%。
注:Image+Text 模态指同时将页面图像及其文本(使用 NV-Ingest 等摄入库提取)作为输入提供给重排序模型,以获得更准确的表示和检索结果。
| 模态 | |||
|---|---|---|---|
| 模型 | 文本 | 图像 | 图像 + 文本 |
| llama-nemotron-embed-vl-1b-v2 | 71.04% | 71.20% | 73.24% |
| + llama-nemotron-rerank-vl-1b-v2 | 76.12% | 76.12% | 77.64% |
下表展示了 llama-nemotron-rerank-vl-1b-v2 与另外两个公开可用的多模态重排序模型 jina-reranker-m0 和 MonoQwen2-VL-v0.1 的评估准确率性能对比。Jina 模型没有商业许可,并且默认不支持 image+text 模态,因此,我们仅报告该模型的 仅图像 和 仅文本 评估分数。
| 模态 | |||
|---|---|---|---|
| 模型 | 文本 | 图像 | 图像+文本 |
| llama-nemotron-rerank-vl-1b-v2 | 76.12% | 76.12% | 77.64% |
| jina-reranker-m0 | 69.31% | 78.33% | NA |
| MonoQwen2-VL-v0.1 | 74.70% | 75.80% | 75.98% |
llama-nemotron-rerank-vl-1b-v2 在文本检索基准上表现出具有竞争力的检索准确率,可与 NVIDIA 的纯文本重排序模型 llama-nemotron-rerank-1b-v2 相媲美。这意味着无论您的检索语料库包含图像、文本还是两者兼有,都可以部署 NVIDIA 基于 VLM 的 llama-nemotron-embed-vl-1b-v2 嵌入模型以及 llama-nemotron-rerank-vl-1b-v2 重排序模型。
| 模型 | BEIR 检索 + TechQA | MIRACL | MLQA | MLDR | 平均值 |
|---|---|---|---|---|---|
| llama-nemotron-embed-1b-v2 + llama-nemotron-rerank-1b-v2 | 73.64% | 65.80% | 86.83% | 68.49% | 73.69% |
| llama-nemotron-embed-vl-1b-v2 + llama-nemotron-rerank-vl-1b-v2 | 73.18% | 65.71% | 87.05% | 69.98% | 73.98% |
按数据集的数据收集方法 混合:自动化、人工、合成
按数据集的标注方法: 混合:自动化、人工、合成
属性 有关 ViDoRe 基准的更多详细信息,请参见其 Hugging Face 页面。
@inproceedings{moreira2025_nvretriever,
author = {Moreira, Gabriel de Souza P. and Osmulski, Radek and Xu, Mengyao and Ak, Ronay and Schifferer, Benedikt and Oldridge, Even},
title = {Improving Text Embedding Models with Positive-aware Hard-negative Mining},
year = {2025},
isbn = {9798400720406},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3746252.3761254},
doi = {10.1145/3746252.3761254},
pages = {2169–2178},
numpages = {10},
keywords = {contrastive learning, distillation, embedding models, hard-negative mining, rag, text retrieval, transformers},
location = {Seoul, Republic of Korea},
series = {CIKM '25}
}NVIDIA 认为可信 AI 是一项共同责任,我们已制定相关政策和实践,以支持各类 AI 应用的开发。当开发者按照我们的服务条款下载或使用本模型时,应与支持其的模型团队合作,确保该模型满足相关行业和用例的要求,并应对未预见的产品误用问题。
有关此模型伦理考量的更多详细信息,请参见可解释性、偏见、安全性和隐私部分。
如发现安全漏洞或 NVIDIA AI 相关问题,请通过此处报告。
| 领域 | 回应 |
|---|---|
| 在模型设计和测试中,来自受不利影响群体(受保护类别)的参与考量 | 无 |
| 为减轻不良偏见所采取的措施 | 无 |
| 领域 | 回应 |
|---|---|
| 预期应用与领域: | 用于问答检索的段落或文档排序。 |
| 模型类型: | Transformer 交叉编码器。 |
| 目标用户: | 从事对话式 AI 模型开发的生成式 AI 开发者。适用于在大型多模态语料库上构建问答应用,并希望通过对给定问题的候选文档集进行重排序来提高检索性能的用户。语料库可能包括视觉丰富的文档图像(例如,包含文本、图形、表格、图表或信息图的页面)和/或从文档中提取的文本。 |
| 输出: | 浮点数列表(表示段落/文档与问题相关性的分数/对数几率)。 |
| 描述模型工作原理: | 该模型输出一个相关性分数(对数几率),反映其预测段落或文档包含回答问题所需信息的强度。 |
| 技术限制: | 模型的最大序列长度为 10240。较长的文本输入应进行截断。 |
| 经测试表明,无论以下哪些因素,模型都能为受不利影响群体提供可比结果: | 不适用 |
| 已验证符合 NVIDIA 规定的质量标准: | 是 |
| 性能指标: | 准确率、吞吐量和延迟。 |
| 潜在已知风险: | 对于给定查询,此模型不总是能保证对文档进行有意义的排序。 |
| 许可与使用条款: | 本模型的使用受 NVIDIA 开放模型许可协议 管辖,后处理脚本的使用受 Apache 2.0 许可。附加信息:Llama 3.2 社区模型许可协议。基于 Llama 构建。 |
| 字段 | 回应 |
|---|---|
| 是否可生成或逆向工程个人数据? | 否 |
| 创建此模型是否使用了个人数据? | 未知 |
| 数据集审查频率? | 数据集在添加时进行初步审查,后续审查根据需要或变更请求进行。 |
| 训练中使用的所有数据集是否都有来源证明? | 是 |
| 数据标注(注释、元数据)是否符合隐私法? | 是 |
| 如果收到数据主体的数据更正或删除请求,数据是否符合要求? | 否,对于外部来源的数据无法实现。 |
| 是否使用了用户与AI模型的交互数据(例如用户输入和提示词)来训练模型? | 否 |
| 是否获得了所使用的任何个人数据的同意? | 不适用 |
| 适用的隐私政策 | https://www.nvidia.com/en-us/about-nvidia/privacy-policy/ |
| 字段 | 回应 |
|---|---|
| 模型应用场景: | 用于检索的文档重排序。用户查询可以是文本,文档可以是文本、文档页面图像、图表、表格和信息图。 |
| 描述物理安全影响(如有)。 | 不适用 |
| 用例限制: | 本模型的使用受 NVIDIA Open Model License Agreement 管辖,后处理脚本的使用受 Apache 2.0 许可。附加信息:Llama 3.2 Community Model License Agreement。基于 Llama 构建。 |
| 模型和数据集限制: | 应用最小权限原则(PoLP),限制数据集生成和模型开发的访问权限。限制在训练期间强制实施数据集访问,并遵守数据集许可约束。 |