Files
myWiki/concepts/searcher-trainer-decoupling.md

74 lines
2.7 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: "Searcher-Trainer 解耦架构"
created: 2026-05-12
updated: 2026-05-12
type: concept
tags: ["distributed-systems", "reinforcement-learning", "llm-post-training"]
sources: ["arxiv:2503.18929"]
---
# Searcher-Trainer 解耦架构
**Searcher-Trainer 解耦** 是 [[tba|TBA]] 的架构基础,将 LLM 后训练中的**探索(数据生成)**和**学习(策略更新)**分配到独立的计算节点上,实现高度并行化。
## 架构对比
### 传统 On-Policy串行
```
单一节点:
Generate → Reward → Update → Generate → Reward → Update → ...
↑ │
└───────────────────────────────────────────────────────┘
每次更新后 GPU 闲置等待生成 / 生成等待更新
```
### TBA Searcher-Trainer并行
```
Searcher 1: Generate ⇢ Reward ⇢ Buffer ─┐
Searcher 2: Generate ⇢ Reward ⇢ Buffer ─┤
... ├── D_global
Searcher N: Generate ⇢ Reward ⇢ Buffer ─┘
每 k 步同步 ─────────┤
Trainer: ← Buffer Sampling ← TB Loss ←┘
```
## 同步协议
- **同步周期 $k$**:每 $k$ 步训练后,暂停以交换权重和 buffer 数据
- **权重传递**Trainer → Searcher更新本地推理策略
- **数据传递**Searcher → Trainer$D_{local} \to D_{global}$
## 节点定义
在 TBA 中,"节点" 是执行完整搜索或训练操作所需的计算资源:
- 1 节点 = **1 GPU**
- 典型配置16 GPU → 15 Searcher + 1 Trainer
- 最小配置2 GPU → 1 Searcher + 1 Trainer
## 效率来源
| 操作 | 瓶颈类型 | 解耦后效果 |
|------|---------|-----------|
| LLM 推理(生成) | Memory-bound | Searcher 持续 vLLM 推理 |
| 策略更新(训练) | Compute-bound | Trainer 持续 forward+backward |
| **关键** | **两者互不等待** | **GPU 利用率接近 100%** |
## 与经典分布式 RL 的关系
TBA 的 Searcher-Trainer 架构类似于 **IMPALA**Espeholt et al., 2018后者也通过 actor-learner 分离实现高效分布式 RL。关键区别
- IMPALA 使用 V-trace需要价值函数 $V(s)$
- TBA 使用 TB 目标(无需 critic
## 相关概念
- [[tba|TBA]] — 框架实现
- [[asynchronous-rl-llm]] — 异步 RL 范式
- [[replay-buffer-rl-llm]] — Buffer 设计
- [[reward-recency-sampling]] — 采样策略
- [[bartoldson-tba-2025|论文页面]]