TOPReward 是一个 零样本奖励模型,它从现成的视觉-语言模型 (VLM) 中提取 token 对数概率,作为机器人奖励信号。给定视频轨迹和任务指令,它返回 VLM 对指令为真的对数似然——无需 fine-tune。
论文:TOPReward: Token Probabilities as Hidden Zero-Shot Rewards for Robotics 项目:topreward.github.io 原始代码:github.com/TOPReward/TOPReward 默认骨干:Qwen/Qwen3-VL-8B-Instruct
TOPReward 询问一个通用 VLM 任务指令的可能性有多大,以机器人尝试完成该任务的视频为条件。具体来说,给定:
它会构建如下形式的聊天提示
<video> "The above video shows a robot manipulation trajectory that completes the following task: <instruction> Decide whether the above statement is True or not. The answer is: True"
将其前向传播通过 VLM,对除最后一个 token 之外的所有内容进行标签掩码,然后读回该 token 的对数概率——默认是结束后缀模板的字面量 "True"。所得的 log P("True" | video + prompt + instruction) 就是奖励。
由于该方法仅依赖于一个冻结的 VLM,TOPReward 是 零样本 的:没有需要托管的 fine-tune 权重。LeRobot 中的“模型”是围绕 transformers 的 Qwen3VLForConditionalGeneration 加上标签掩码逻辑的一个小封装。处理器持有分词器并构建完整的聊天提示(EO-1/Robometer 模式)。
reward_model.type=topreward 配置。transformers Qwen3VLForConditionalGeneration API 加载 VLM。QwenClient.compute_instruction_reward 匹配)。compute_reward() 为每个样本返回一个标量对数概率。save_pretrained 仅写入 config.json(VLM 由 vlm_name 标识)。topreward_progress.parquet(SARM 兼容模式)。当前的 LeRobot 移植版本仅支持 Qwen3-VL 客户端。其他上游客户端(Gemini、OpenAI、Gemma、Molmo)可作为后续附加项添加。
pip install -e ".[topreward]"或者,从源码检出使用 uv 时:
uv sync --extra topreward这会引入 transformers。首次运行 TOPReward 时,Hugging Face 还会从 Hub 下载 VLM 权重(Qwen3-VL-8B-Instruct 约 16 GB)。强烈建议使用 GPU。
TOPReward 期望:
在 LeRobot dataset 中,预处理器读取:
| 配置字段 | 默认值 | 含义 |
|---|---|---|
reward_model.image_key | observation.images.top | TOPReward 使用的相机 observation |
reward_model.task_key | task | 补充数据中任务字符串的键 |
reward_model.max_frames | 16 | 每个样本的帧数上限 |
reward_model.fps | 2.0 | 传递给 Qwen 视频处理器的元数据 |
reward_model.vlm_name | Qwen/Qwen3-VL-8B-Instruct | 底层 VLM 的 Hugging Face Hub id |
该模型返回:
compute_reward(batch):每个样本一个对数概率。越高 = 任务-视频对齐越好。当 success_threshold 为有限值时,改为返回二值化阈值结果。from lerobot.rewards.topreward import TOPRewardConfig, TOPRewardModel
cfg = TOPRewardConfig(
vlm_name="Qwen/Qwen3-VL-8B-Instruct",
device="cuda",
)
reward_model = TOPRewardModel(cfg)from lerobot.rewards import make_reward_model, make_reward_model_config, make_reward_pre_post_processors
cfg = make_reward_model_config(
"topreward",
vlm_name="Qwen/Qwen3-VL-8B-Instruct",
device="cuda",
image_key="observation.images.top",
)
reward_model = make_reward_model(cfg)
preprocessor, postprocessor = make_reward_pre_post_processors(cfg)预处理器对完整提示(视频 + 前缀 + 指令后缀)进行分词,在 observation.topreward.* 下写入 Qwen-VL 张量 + prompt_length。模型读取这些张量,基于 prompt_length 进行标签掩码,并提取对数概率奖励。
为 RA-BC 训练和叠加视频写入一个 topreward_progress.parquet:
# Sparse-dense (15 anchors per episode, matches upstream)
uv run python -m lerobot.rewards.topreward.compute_rabc_weights \
--dataset-repo-id lerobot/libero_10_image \
--num-samples 15 \
--device cuda然后为任意 episode 渲染进度叠加:
uv run examples/dataset/create_progress_videos.py \
--repo-id lerobot/libero_10_image \
--episode 0 \
--progress-file topreward_progress.parquet \
--gif默认提示与上游论文一致:
prompt_prefix = "The above video shows a robot manipulation trajectory that completes the following task: "
prompt_suffix_template = "{instruction} Decide whether the above statement is True or not. The answer is: True"两者都暴露在 TOPRewardConfig 上以供消融实验。后缀模板 必须 包含 {instruction}。
add_chat_template=True 在分词之前用分词器的聊天模板包装完整提示(包括指令)。默认为 False,与上游论文的主要实验一致。
forward() 未被重写,is_trainable 返回 False。@article{chen2026topreward,
title={TOPReward: Token Probabilities as Hidden Zero-Shot Rewards for Robotics},
author={Chen, Shirui and Harrison, Cole and Lee, Ying-Chun and Yang, Angela Jin and
Ren, Zhongzheng and Ratliff, Lillian J and Duan, Jiafei and Fox, Dieter and
Krishna, Ranjay},
journal={arXiv preprint arXiv:2602.19313},
year={2026}
}原始 TOPReward 代码库采用 MIT 许可证。LeRobot 移植版本遵循 LeRobot Apache 2.0 许可证;所封装的 Qwen3-VL 权重受原始 Qwen 许可证约束。
在 GitHub 上更新