Files
myWiki/concepts/tool-efficient-path-reward.md
2026-06-01 10:46:01 +08:00

50 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Tool-Efficient Path Reward"
created: 2026-05-31
type: concept
tags: [reinforcement-learning, reward-design, trajectory-optimization, tool-calling]
---
# Tool-Efficient Path Reward工具高效路径奖励
**Tool-Efficient Path Reward** 是 [[toolcua-optimal-gui-tool-orchestration|ToolCUA]] 在线 Agentic RL 阶段的核心奖励设计,由两部分组成:
$$R = R_{\text{fmt}} + R_{\text{acc}} + \lambda \cdot R_{\text{tool}} + \beta \cdot R_{\text{length}}$$
其中 $\lambda = 0.4, \beta = 0.2$。
## 两大组件
### $R_{\text{tool}}$Tool Appropriateness Reward工具适当性奖励
$$R_{\text{tool}} = I_{\text{succ}} \cdot I[(t_b > 0 \land c > 0) \lor (t_b < 0 \land c = 0)]$$
- $t_b \in \{1, -1\}$任务级"工具有益"标签数据构建时标注
- $c$轨迹中工具调用累计次数
**设计哲学**
- $t_b = 1, c > 0$:工具有益任务 + 实际调用了工具 → 奖励 ✓
- $t_b = -1, c = 0$:工具无益任务 + 未调用工具 → 奖励 ✓
- **将工具使用与任务成功解耦**——即使任务成功,不当工具使用也不获额外奖励
### $R_{\text{length}}$Path Efficiency Reward路径效率奖励
$$R_{\text{length}} = I_{\text{succ}} \cdot \begin{cases} (1 + \frac{\bar{s} - s}{\bar{s}}) & s < \bar{s} \\ \exp(-\frac{s - \bar{s}}{S_{\max} - \bar{s}}) & s \geq \bar{s} \end{cases}$$
- $s$当前轨迹步数
- $\bar{s}$rollout 组平均步数
- $S_{\max}$最大执行上限30
**设计哲学**
- 短于组平均 线性奖励步数越短奖励越高
- 长于组平均 指数衰减惩罚冗长路径
- 因为有效工具调用通常替代多步 GUI 原子操作这一信号自然激励更高效的工具切换
## 为什么需要这个奖励?
任务成功信号 $R_{\text{acc}}$ **无法区分**
- 1 次工具调用完成 vs 15 GUI 绕路完成
- 任务不需要工具却调用了工具 vs 合理使用工具
$R_{\text{tool}} + R_{\text{length}}$ 提供**轨迹级反馈**将优化目标从"完成任务"提升到"高效地完成任务"。