WAR: Workload-Aware Rollouts for Synchronous Agentic Reinforcement Learning
面向同步 Agentic RL 的 workload-aware rollout 系统,通过 model-free speculative decoding (SuffixDecoding) 和 cache-aware scheduling 联合优化解码与调度
WAR: Workload-Aware Rollouts for Synchronous Agentic Reinforcement Learning
一、论文概述
| 项目 | 内容 |
|---|---|
| 标题 | WAR: Workload-Aware Rollouts for Synchronous Agentic Reinforcement Learning |
| 作者 | Ryan Xu, Atlas Zhao, David Bao, Frank Du |
| 机构 | — |
| 论文 | arXiv:2607.17299 |
| 代码 | — (基于 veRL v0.8.0 实现约 7K 行 Python 代码,未单独开源) |
| 发布 | 2026-07-19 |
核心贡献:
- 提出 WAR(Workload-Aware Rollout)——一个面向长上下文 agentic RL 训练的 workload-aware rollout 系统,联合优化 decoding 和 scheduling
- 关键洞察:最优 rollout 优化策略取决于运行时负载——低负载下 GPU 利用率不足,高负载下 KV-cache 压力、冗余计算和负载不均衡成为瓶颈
- 低负载场景:引入 model-free speculative decoding(SuffixDecoding),复用历史轨迹中的 suffix patterns 作为 speculative drafts,无需额外 draft model,避免 GPU 资源竞争
- 高负载场景:切换到 cache-aware global scheduling,基于 cache locality、trajectory progress 和 server load 在多 rollout replicas 间分配请求,减少冗余 KV-cache 重计算
- 在 Qwen3-32B + SWE 数据集上的实验表明:WAR 在低负载下提升 1.4× rollout throughput,高负载下提升最高 1.6×
二、核心思想
问题定义
Long-horizon rollout generation 已成为 agentic RL 训练中的主导系统瓶颈。Agent 与环境进行多轮交互时,trajectory 快速膨胀到数万字��� token,使得 synchronous RL 训练越来越受限于 rollout 阶段。
具体挑战:
- KV-cache 足迹动态增长:一个 long-reasoning request 可能从小内存开始,但随着解码进展膨胀到数十 GB,迫使 batch size 缩小、触发 request preemption、导致昂贵的 re-prefill 操作
- Rollout 长度高度不平衡:long-tail response length 是 synchronous rollout 效率低下的关键来源。少量长 trajectory 可导致许多 rollout worker 长时间空闲,产生 GPU bubbles
- 异步 rollout 的局限:虽然可以重叠 rollout 和 training 提高硬件利用率,但会引入 policy staleness(旧参数生成的轨迹用于更新新策略)和 distributional skew(短样本过度出现在早期训练批次中)
解决方案概述
WAR 的核心洞察:最优 rollout 优化策略取决于 runtime load。
| 负载场景 | 瓶颈 | WAR 策略 |
|---|---|---|
| 低负载 (batch size < 16) | GPU 利用率不足 | SuffixDecoding:model-free speculative decoding,复用历史 suffix patterns |
| 高负载 (batch size ≥ 16) | KV-cache 压力、冗余计算、负载不均衡 | Cache-aware scheduling:全局调度器基于 cache locality 分配请求 |
两种技术通过 workload-aware 机制自动切换,无需改变底层 RL 算法。
为什么 SuffixDecoding 适合 Agentic RL?
GRPO-like 算法的天然特性使 SuffixDecoding 特别有效:
- 每个 request rollout 次生成多条 trajectory
- 这些 trajectory 来自同一 prompt,与相似 task environment 交互
- 经常呈现重复的 local string patterns(尤其是 recurring code snippets)
- 不同 prompt 可能生成相似 code fragments(cross-prompt similarity)
- 同一 prompt 的多条 rollout 经常共享相似局部结构(intra-prompt similarity)
三、技术架构
整体框架
WAR 架构分为两个控制层级(Figure 1, Figure 2):
- Global Scheduler(系统级):跨 rollout replicas 执行 cache-aware request placement
- Inference Instance(解码级):每个推理实例根据 local effective batch size 独立启用/禁用 SuffixDecoding
每步 RL 训练结束后,新生成的 trajectories 广播到所有 replicas,同步 local suffix caches。


Cache-Aware Scheduling
调度策略
当全局调度器中的总请求数 时,对所有 queued prompts 打分以决定调度优先级。低于阈值时回退到 veRL 默认的 least-request + sticky-session 策略。

四维调度评分
优先级由四个维度综合评分:
| 因子 | 符号 | 含义 | 方向 |
|---|---|---|---|
| Cache hit rate | 当前 routed rollout instance 的 KV cache 命中率 | 越高越好 () | |
| Estimated assistant turns | 在线估计的助手轮数(正比于 context length) | 越短越好 () | |
| Inflight requests | 各 rollout replica 上的 in-flight 请求数 | 越少越好 () | |
| Waiting time | 请求在队列中的等待时间 | 超时保护 () |
评分公式
其中约束条件:, , , , 。
- 负 偏好短 trajectory 先完成,释放 KV cache 给长 trajectory
- 负 偏好调度到负载较轻的 server,减少负载不均衡
- 确保 sandbox TTL 超时的请求优先调度,避免 trajectory 被过早终止
Assistant Turn 在线估计
利用 rollout group 内相似性,每次 rollout 完成后更新:
其中 是 group 的实际 observed assistant turn 数, 为 smoothing factor。
SuffixDecoding
工作原理
SuffixDecoding 是一种 model-free speculative decoding:
- 存储历史 trajectories 作为 suffix cache
- 将当前 token pattern 与历史匹配生成 draft tokens
- 由 target model(verifier)并行验证 draft tokens
- 无需额外的 draft model,避免与 rollout generation 争夺 GPU 资源
与 Model-based Speculative Decoding 的区别
| 特性 | Model-based | SuffixDecoding (Model-free) |
|---|---|---|
| Draft model | 需要额外模型 | 无需,复用历史 suffix |
| GPU 竞争 | 与 target model 竞争资源 | 无额外 GPU 竞争 |
| 适用场景 | 通用加速 | Agentic RL 中的 recurring patterns |
| 实现复杂度 | 需维护 draft + target 两模型 | 仅需 suffix cache 管理 |
SuffixDecoding 的工作负载依赖特性
SuffixDecoding 的收益强烈依赖 batch size:
- 小 batch size:normal batched decoding underutilizes GPU,speculative decoding 增加 parallelism,提升 hardware utilization
- 大 batch size:normal decoding 已饱和 GPU 资源,speculative verification 引入额外 overhead(draft generation、verification、tree-mask management),反而降低 throughput
工作负载边界
实验中发现 low/high load 的分界线约为 batch size = 16:
- Batch size < 16:SuffixDecoding 效果显著
- Batch size ≥ 16:Cache-aware scheduling 效果更突出,SuffixDecoding 收益递减甚至为负
四、核心创新
| 创新点 | 说明 | 理论/实验依据 |
|---|---|---|
| Workload-aware 双模式优化 | 低负载用 SuffixDecoding,高负载用 Cache-aware scheduling | Sec. 3.4:负载依赖的最优策略分析 |
| Model-free speculative decoding | 利用 GRPO-like 算法中多 trajectory 的 recurring patterns | Sec. 3.5:cross-prompt + intra-prompt similarity |
| 四维调度评分 | Cache locality + estimated length + replica load + waiting TTL | Eq. (3):线性组合四个调度因子 |
| Online estimated assistant turns | 利用 rollout group 内相似性实时更新长度预测 | Sec. 3.4: 平滑更新公式 |
| Suffix cache 同步机制 | 每步 RL 后将新 trajectories 广播到所有 replicas | Figure 2:architecture diagram |
五、代码实现分析
实现基础:
- 基于 veRL v0.8.0 实现,约 7K 行 Python 代码
- 使用 SGLang v0.5.5 作为 rollout inference engine
- 将 SuffixDecoding 集成到 SGLang 推理 pipeline
- veRL 的 reward 和 training 组件保持不变
- Megatron-LM v0.13.1 作为 training backend
- 额外实现了 SWE agent,支持 multi-turn interaction with customized sandbox
关键模块:
- Global Scheduler:实现 cache-aware scheduling 的四维评分逻辑
- SuffixCache Manager:管理历史 trajectory 的存储、匹配和跨 replica 同步
- Workload Detector:根据 effective batch size 动态切换 SuffixDecoding 开关
- SWE Agent:veRL 中的软件工程 agent,支持多轮 sandbox 交互
硬件要求:
- 16× H100 GPUs(2 nodes × 8 GPUs/node),InfiniBand 互联
- Training-side: TP=4, PP=2, CP=2
- Rollout-side: TP=4
六、实验结果
实验设置
| 配置项 | 值 |
|---|---|
| 模型 | Qwen3-32B(YaRN 扩展至 96K context) |
| 数据集 | SWE dataset,500 prompts |
| 硬件 | InfiniBand H100 cluster,2 nodes × 8 GPUs |
| 训练 batch size | 4, 8, 16, 32, 64(覆盖 low → high load) |
| Rollout per prompt | 8 次 |
| 训练步骤 | 5 steps |
| Temperature / top_p / top_k | 1.0 / 1.0 / 200 |
| Max assistant turns | 120 |
| Baseline | veRL_base(关闭 cache-aware scheduling 和 SuffixDecoding) |
实验配置对比
| 配置 | Cache-aware Scheduling | SuffixDecoding |
|---|---|---|
| veRL_base | × | × |
| sched_only | ✓ | × |
| spec_only | × | ✓ |
| sched_spec | ✓ | ✓ |
负载均衡验证(Tab. 1)
所有配置相对于 veRL_base 的工作量差异均值保持在 5% 以内:
| Metric | sched_only | spec_only | sched_spec |
|---|---|---|---|
| Prefill tokens | |||
| Decode tokens | |||
| Assistant turns |
End-to-End Evaluation
Prefill Throughput(Figure 4)

| Batch Size | sched_only 改进 | spec_only 改进 | sched_spec 改进 |
|---|---|---|---|
| 4 → 64 | 0% → 47% | 53% → 5% | 35% → 63% |
关键发现:
- sched_only 随负载增长效果增强(0% → 47%)
- spec_only 随负载增长效果衰减(53% → 5%)
- sched_spec 在全负载范围保持 35%~63% 的稳定提升
Decode Throughput(Figure 5)

| Batch Size | sched_only 改进 | spec_only 改进 | sched_spec 改进 |
|---|---|---|---|
| 4 → 64 | -4% → 47% | 48% → 5% | 32% → 63% |
关键发现:
- spec_only 在小 batch size 时 decode throughput 提升最大(48% @ BS=4)
- 当 batch size ≥ 16 时,SuffixDecoding 开始不如非-SuffixDecoding 基线
- sched_spec 在全负载范围保持 32%~63% 的 robust 提升
End-to-End Rollout Time(Figure 6)

- SuffixDecoding 主要在 low load 下减少 rollout 时间
- Cache-aware scheduling 随负载增长提供更大收益
- 两者结合在所有评估的 batch sizes 上实现一致的端到端加速
总体提升: 低负载下 1.4×,高负载下最高 1.6×
KV-Cache Hit Rate(Figure 7)

| 负载 | veRL_base / spec_only | sched_only / sched_spec |
|---|---|---|
| Low (BS=4) | ~0.94 | ~0.94 |
| Low (BS=8) | ~0.93 | ~0.93 |
| High (BS=64) | ~0.1 | ~0.5 |
关键发现:
- 低负载下所有配置均达到很高的 cache hit rate(0.93-0.94)
- 高负载下,veRL_base 和 spec_only 的 cache hit rate 从 ~0.9 暴跌至 ~0.1
- 启用 cache-aware scheduling 的配置(sched_only, sched_spec)在高负载下仍保持 ~0.5 的较高命中率
Acceptance Length(Figure 9)

| 负载 | spec_only | sched_spec |
|---|---|---|
| BS < 16 (low) | ~2.8 | ~2.8 |
| BS ≥ 16 (high) | ~6.0 | ~6.0 |
关键发现:
- 两种负载下 acceptance length 均远大于 1,证明 SuffixDecoding 能生成有用的 draft tokens
- 高负载下 acceptance length 反而更高(~6.0 vs ~2.8),因为长 trajectory 中 recurring patterns 更多
- 但高 acceptance length 不一定转化为更高 throughput(verification overhead 在大 batch 时更显著)
SuffixDecoding Ablation(Figure 10, Tab. 3)

| Batch Size | rollout_n=4 | rollout_n=8 |
|---|---|---|
| 4 | 2.7 | 2.7 |
| 8 | 2.6 | 5.5 |
关键发现:
- rollout_n 越大,acceptance length 越高(更多相似 trajectory 提供更多 suffix match 机会)
- SuffixDecoding 受益于 cross-prompt similarity 和 intra-prompt rollout similarity 双重因素
Cache-Aware Scheduling Ablation(Figure 8)
在 batch size = 16 下的 ablation study:

| 变体 | 说明 | 性能 |
|---|---|---|
| cache_only | 仅考虑 cache locality | 最佳单项性能 |
| turn_only | 仅考虑 estimated length | 中等 |
| inflight_only | 仅考虑 replica load | 较差 |
| sched_only (full) | 四项综合 | 最佳整体 |
关键发现:
- cache_only 实现最佳单项性能,凸显 KV-cache locality 的重要性
- 完整的 sched_only(联合考虑 estimated trajectory length、cache locality、replica load)实现最高 prefill/decode throughput、最低 rollout time 和最高 cache hit rate
- 三个调度因子相互补充
Waiting Factor Ablation(Tab. 2)
禁用 相对于启用的影响(% relative difference):
| Batch Size | Prefill tokens | Decode tokens | Assistant turns | Rollout end-to-end time |
|---|---|---|---|---|
| 32 | -11.7% | -8.6% | -9.4% | -12.0% |
| 64 | -44.5% | -41.3% | -38.9% | -46.9% |
关键发现: 随着负载增加,waiting factor 的作用愈发重要。高负载下禁用 waiting factor 导致 rollout end-to-end time 恶化 46.9%,因为 sandbox TTL 超时的请求无法及时调度。
七、相关工作
RL Training Systems
- Stage-overlap systems(如 RLHFuse)通过融合 rollout/reward/training 阶段减少 pipeline bubble
- 异步执行系统(AReaL 等)通过 relaxed synchronization 提高利用率
- WAR 与之不同:聚焦加速 synchronous rollout 本身,不改变底层 RL 算法或 relaxation 同步边界
Rollout Scheduling for Synchronous RL
- RollPacker:tail batching,将可能产生长 response 的 prompts 合并到少数长 rounds
- Seer:将 prompt groups 分解为 finer-grained chunks,context-aware scheduling
- WAR 与之互补:不只关注 long-tail scheduling,而是将 rollout optimization 视为 workload-dependent,结合 cache-aware scheduling 和 decoding-level acceleration
Speculative Decoding for RL Rollout
- TLT:adaptive model-based drafter 使用 idle GPUs
- DAS:distribution-aware speculative decoding
- WAR 的 SuffixDecoding 是 model-free,避免 draft model 与 target model 的 GPU 竞争
LLM Serving and Cache-Aware Scheduling
- CONCUR:congestion-based concurrency control for agentic batch inference
- WAR 的 cache-aware scheduling 专注于 rollout replica 间的 request placement
八、局限性
- SuffixDecoding 的高负载退化:当 batch size ≥ 16 时,SuffixDecoding 的 decode throughput 不如非 SuffixDecoding 基线
- Waiting factor 的高负载敏感性:禁用 waiting factor 在 batch size=64 时导致 rollout time 恶化 46.9%
- 评估规模有限:仅在 500 prompts 的 SWE dataset 上评估,5 training steps
- Scaling 未知:在更大规模集群和更长 horizon 任务上的表现待验证
- Suffix cache 管理开销:跨 replica 同步 suffix cache 的通信成本未详细分析
九、未来方向
- 自适应 workload boundary:动态确定 low/high load 分界点,而非固定 threshold
- Learned scheduling policy:用 learnable 的权重替代 hand-crafted scale factors
- Cross-dataset evaluation:扩展到 coding、math、general QA 等多种 agent 任务
- Suffix cache 压缩:研究高效的历史 trajectory 存储和检索策略
- Multi-model support:适配不同规模 LLM 的 rollout 优化
十、总结
核心贡献
- Workload-aware 双模式优化:WAR 根据运行时负载自动选择最优策略——低负载用 SuffixDecoding,高负载用 cache-aware scheduling
- Model-free speculative decoding:SuffixDecoding 利用 GRPO-like 算法中多 trajectory 的 recurring patterns,无需额外 draft model
- 四维调度评分:Cache locality + estimated length + replica load + waiting TTL 的综合调度策略
- 即插即用:基于 veRL 实现,约 7K 行 Python 代码,不改变底层 RL 算法
- 鲁棒加速:跨全负载范围保持 1.4×~1.6× rollout throughput 提升
关键实验结论
- sched_only 随负载增长效果增强(prefill throughput 改进 0% → 47%)
- spec_only 随负载增长效果衰减(decode throughput 改进 48% → 5%)
- sched_spec 在全负载范围保持 35%~63% 的稳定提升
- Cache-aware scheduling 在高负载下将 cache hit rate 从 ~0.1 提升至 ~0.5
- SuffixDecoding 在低负载下 acceptance length ~2.8,高负载下 ~6.0
- Waiting factor 在高负载下至关重要(禁用导致 46.9% rollout time 恶化)
附图索引
| 编号 | 文件名 | 说明 |
|---|---|---|
| Figure 1 | figures/war/figure-1-WAR-diagram.png | WAR motivation:低负载用 speculative decoding,高负载用 cache-aware scheduling |
| Figure 2 | figures/war/figure-2-WAR-architecture.png | WAR 架构:双层 workload-aware 优化控制 |
| Figure 3 | figures/war/figure-3-WAR-sched-example.png | Cache-aware scheduling 示例:two replicas, three queued requests |
| Figure 4 | figures/war/figure-4-fig1-prefill-throughput-20260716-212322.png | Prefill throughput across batch sizes (4-64) |
| Figure 5 | figures/war/figure-5-fig1-decode-throughput-20260716-212322.png | Decode throughput across batch sizes |
| Figure 6 | figures/war/figure-6-fig1-rollout-time-20260716-212322.png | End-to-end rollout time reduction |
| Figure 7 | figures/war/figure-7-fig2-cache-hit-rate-20260716-215211.png | KV-cache hit rate across batch sizes |
| Figure 8 | figures/war/figure-8-cache-aware-scheduling-ablation-20260717-104908.png | Cache-aware scheduling ablation (4 panels) |
| Figure 9 | figures/war/figure-9-fig2-acceptance-length-20260716-215211.png | Average acceptance length of SuffixDecoding |
| Figure 10 | figures/war/figure-10-suffix-decode-batch-20260717-115907.png | Batch size effect on SuffixDecoding throughput |
附表格索引
| 编号 | 说明 |
|---|---|
| Table 1 | Workload differences relative to veRL_base(所有配置工作量差异 < 5%) |
| Table 2 | Waiting factor ablation(禁用对 rollout 的影响) |
| Table 3 | Acceptance length at 1st step under different batch size and rollout_n |