Instructions to use quiyver/intern-vl-2.5-reward with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use quiyver/intern-vl-2.5-reward with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="quiyver/intern-vl-2.5-reward", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("quiyver/intern-vl-2.5-reward", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
InternVL2.5-2B Multimodal Reward Model
这是一个基于 OpenGVLab/InternVL2_5-2B 的多模态标量奖励模型。模型接收图像、问题和候选回答,为每个候选回答输出一个实数 reward。分数仅适合比较同一图像和问题下的候选回答,不应解释为概率。
本仓库是完整合并检查点:LoRA 已合并进 InternVL 主干,FP32 score head 也包含在标准 safetensors 分片中。使用时不需要另行下载基座、挂载 PEFT adapter 或手动加载 score_head.pt。
Results
| Benchmark | Correct | Accuracy |
|---|---|---|
| VLRewardBench, full test split | 869 / 1,250 | 69.52% |
评测使用固定大小 448 x 448 的单图输入、最大文本长度 1,536、BF16 推理。基座结果为生成式二选一评测,奖励模型结果为标量排序评测,因此两者并非完全相同的推理形式。
Installation
建议使用支持 BF16 的 NVIDIA GPU。
pip install -r requirements.txt
如果直接通过 Hugging Face Hub 加载,只需要安装同版本依赖:
pip install torch==2.8.0 transformers==4.57.6 accelerate==1.10.1 \
timm==1.0.27 einops==0.8.2 sentencepiece==0.2.1 pillow==11.3.0
Quick start
trust_remote_code=True 是必需的,因为本仓库包含 InternVL 和奖励头的自定义模型代码。
import torch
from transformers import AutoModel, AutoTokenizer
model_id = "quiyver/intern-vl-2.5-reward"
model = AutoModel.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.bfloat16,
low_cpu_mem_usage=True,
).cuda().eval()
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True,
use_fast=False,
)
scores = model.score_answers(
tokenizer=tokenizer,
image="example.jpg",
question="What is shown in the image?",
answers=[
"A dog is running on grass.",
"A passenger aircraft is taking off.",
],
)
print(scores)
print("preferred answer:", max(range(len(scores)), key=scores.__getitem__))
也可以在克隆后的仓库中运行:
python inference.py \
--model . \
--image example.jpg \
--question "What is shown in the image?" \
--answer "A dog is running on grass." \
--answer "A passenger aircraft is taking off."
Reproduce VLRewardBench
评测脚本会直接下载官方 Hugging Face 数据集,并固定数据集 revision:
python eval_vlrewardbench.py \
--model . \
--output results/vlrewardbench_predictions.jsonl
固定的数据版本为:
- Dataset:
MMInstruction/VL-RewardBench - Revision:
0e6e62701eba92818a69ce95af0ed7aa0648b176 - Split:
test, 1,250 samples
脚本会生成逐样本预测 JSONL 和汇总 JSON,便于核验正确数、准确率、同分数量以及各 query_source 的结果。
Model architecture and training
- Backbone:
OpenGVLab/InternVL2_5-2B - Base revision:
573169ee54df216786bb9a189e9a32a060a008cf - Frozen during training: vision tower and multimodal projector
- Trainable modules: language-model LoRA and score head
- LoRA: rank 16, alpha 32, dropout 0.05; targets
wqkv,wo,w1,w2,w3 - Reward head:
LayerNorm(2048) -> Linear(2048, 1024) -> GELU -> Linear(1024, 1) - Pooling: final non-padding token hidden state
- Objective: Bradley-Terry pairwise logistic loss
- Training pairs: 30,000
- RLAIF-V: 12,134
- RLHF-V: 5,732
- VLFeedback: 12,134
- Effective batch size: 16
- Total optimizer steps: 1,876
- Learning rates:
2e-5, followed by1e-5during continuation - Training precision: BF16
- Training hardware: one NVIDIA GeForce RTX 4090
训练和原始评测代码:https://github.com/trizszer/intern_vl_reward,对应 commit fe90ab4cc4421273114d3a3724bc7229a14e841d。
Checkpoint integrity
merge_manifest.json 记录了原始基座、LoRA、score head 和所有合并后分片的 SHA-256。模型采用 6 个 safetensors 分片,总参数量 2,207,857,665,其中 score head 保持 FP32,其余主干权重为 BF16。
Limitations
- 该奖励模型主要用于候选回答排序,不生成回答。
- 训练数据来源的标注尺度没有统一校准。
- 训练集与 VLRewardBench 尚未完成图像和文本级样本去重,因此 69.52% 应理解为当前数据与评测设置下的结果。
- General 类问题的表现低于 hallucination 和 reasoning 类问题。
Upload this folder
从本目录执行:
hf auth login
hf upload-large-folder USER_OR_ORG/REPO_NAME . --repo-type model
目标仓库应为空。请上传本目录本身,不要再套一层 base_model/ 或 reward_model/,也不要上传 .cache、训练日志或旧 adapter。
- Downloads last month
- 4
Model tree for quiyver/intern-vl-2.5-reward
Base model
OpenGVLab/InternVL2_5-2B