Files
myWiki/concepts/reward-recency-sampling.md

56 lines
1.9 KiB
Markdown
Raw Permalink 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: "奖励-最近度混合采样"
created: 2026-05-12
updated: 2026-05-12
type: concept
tags: ["reinforcement-learning", "sampling-strategy", "replay-buffer"]
sources: ["arxiv:2503.18929"]
---
# 奖励-最近度混合采样
**奖励-最近度混合采样** 是 [[tba|TBA]] 中从 [[replay-buffer-rl-llm|Global Replay Buffer]] 采样数据的核心策略,在**稳定性**recency和**探索**reward之间取得平衡。
## 两种采样策略
### 1. Recency 优先(概率 $m$
采样最近同步步骤中添加的数据(最多 $2k-1$ 步 off-policy**近似 on-policy**
目的:保持训练稳定性,确保策略不会因过于陈旧的 off-policy 数据而剧烈震荡。
### 2. 奖励优先(概率 $1-m$
在奖励优先模式下,进一步混合两种分布:
- **Softmax(reward)**:偏向高奖励轨迹 → **利用**
- **Uniform**:等概率采样所有轨迹 → **探索**
目的:发现和强化高奖励行为模式,同时避免 mode collapse。
## 参数 $m$ 的影响
| $m$ 值 | 行为 | 效果 |
|--------|------|------|
| $m=1$ | 纯 recency | 最稳定,但可能探索不足 |
| $m=0.5$$0.6$ | **推荐** | 平衡稳定性与探索 |
| $m=0$ | 纯 reward | 可能 mode collapse |
**实验发现**PFTPythia 410M
- $m=0.4$: win rate 0.67(最低)
- $m=0.5$: win rate 0.82(最佳)
- $m=0.6$: win rate 0.80
## 设计哲学
与标准 RL 的 $\epsilon$-greedy 不同TBA 的混合采样直接在 **buffer 层面** 操作:
- Recency 模式处理分布偏移distribution shift
- Reward 模式处理信用分配credit assignment
- 两者在 query 级别随机切换(同一 batch 中不同 query 可能使用不同策略)
## 相关概念
- [[tba|TBA]] — 框架实现
- [[replay-buffer-rl-llm]] — Buffer 设计
- [[off-policy-llm-post-training]] — Off-policy 范式
- [[bartoldson-tba-2025|论文页面]]