Back to blog

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

核心贡献:

  1. 提出 WAR(Workload-Aware Rollout)——一个面向长上下文 agentic RL 训练的 workload-aware rollout 系统,联合优化 decoding 和 scheduling
  2. 关键洞察:最优 rollout 优化策略取决于运行时负载——低负载下 GPU 利用率不足,高负载下 KV-cache 压力、冗余计算和负载不均衡成为瓶颈
  3. 低负载场景:引入 model-free speculative decoding(SuffixDecoding),复用历史轨迹中的 suffix patterns 作为 speculative drafts,无需额外 draft model,避免 GPU 资源竞争
  4. 高负载场景:切换到 cache-aware global scheduling,基于 cache locality、trajectory progress 和 server load 在多 rollout replicas 间分配请求,减少冗余 KV-cache 重计算
  5. 在 Qwen3-32B + SWE 数据集上的实验表明:WAR 在低负载下提升 1.4× rollout throughput,高负载下提升最高 1.6×

二、核心思想

问题定义

Long-horizon rollout generation 已成为 agentic RL 训练中的主导系统瓶颈。Agent 与环境进行多轮交互时,trajectory 快速膨胀到数万字��� token,使得 synchronous RL 训练越来越受限于 rollout 阶段。

具体挑战:

  1. KV-cache 足迹动态增长:一个 long-reasoning request 可能从小内存开始,但随着解码进展膨胀到数十 GB,迫使 batch size 缩小、触发 request preemption、导致昂贵的 re-prefill 操作
  2. Rollout 长度高度不平衡:long-tail response length 是 synchronous rollout 效率低下的关键来源。少量长 trajectory 可导致许多 rollout worker 长时间空闲,产生 GPU bubbles
  3. 异步 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 nn 次生成多条 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):

  1. Global Scheduler(系统级):跨 rollout replicas 执行 cache-aware request placement
  2. Inference Instance(解码级):每个推理实例根据 local effective batch size 独立启用/禁用 SuffixDecoding

每步 RL 训练结束后,新生成的 trajectories 广播到所有 replicas,同步 local suffix caches。

WAR motivation:低负载用 speculative decoding,高负载用 cache-aware scheduling

WAR 双层 workload-aware 优化控制架构

Cache-Aware Scheduling

调度策略

当全局调度器中的总请求数 Nreq,tot≥ThrschedN_{\text{req,tot}} \geq Thr_{\text{sched}} 时,对所有 queued prompts 打分以决定调度优先级。低于阈值时回退到 veRL 默认的 least-request + sticky-session 策略。

Cache-aware scheduling 示例:two replicas, three queued requests

四维调度评分

优先级由四个维度综合评分:

因子符号含义方向
Cache hit rateHH当前 routed rollout instance 的 KV cache 命中率越高越好 (Scache>0S_{\text{cache}} > 0)
Estimated assistant turnsT^g\hat{T}_g在线估计的助手轮数(正比于 context length)越短越好 (Sturn<0S_{\text{turn}} < 0)
Inflight requestsNrepinflightN_{\text{rep}}^{\text{inflight}}各 rollout replica 上的 in-flight 请求数越少越好 (Sinflight<0S_{\text{inflight}} < 0)
Waiting timetreqwaitingt_{\text{req}}^{\text{waiting}}请求在队列中的等待时间超时保护 (Swaiting>0S_{\text{waiting}} > 0)

评分公式

S=Swaiting+Sturn+Scache+SinflightS = S_{\text{waiting}} + S_{\text{turn}} + S_{\text{cache}} + S_{\text{inflight}} S=1 ⁣(treqwait>scalettl⋅ttlsandbox)⋅scalewaiting⋅treqwait+scaleturn⋅T^g+scalecache⋅H+scaleinflight⋅NrepinflightS = \mathbf{1}\!\left(t_{\text{req}}^{\text{wait}} > \text{scale}_{\text{ttl}} \cdot \text{ttl}_{\text{sandbox}}\right) \cdot \text{scale}_{\text{waiting}} \cdot t_{\text{req}}^{\text{wait}} + \text{scale}_{\text{turn}} \cdot \hat{T}_g + \text{scale}_{\text{cache}} \cdot H + \text{scale}_{\text{inflight}} \cdot N_{\text{rep}}^{\text{inflight}}

其中约束条件:Swaiting>0S_{\text{waiting}} > 0, Sturn<0S_{\text{turn}} < 0, Scache>0S_{\text{cache}} > 0, Sinflight<0S_{\text{inflight}} < 0, 0<scalettl<10 < \text{scale}_{\text{ttl}} < 1。

  • 负 scaleturn\text{scale}_{\text{turn}} 偏好短 trajectory 先完成,释放 KV cache 给长 trajectory
  • 负 scaleinflight\text{scale}_{\text{inflight}} 偏好调度到负载较轻的 server,减少负载不均衡
  • scalewaiting\text{scale}_{\text{waiting}} 确保 sandbox TTL 超时的请求优先调度,避免 trajectory 被过早终止

Assistant Turn 在线估计

利用 rollout group 内相似性,每次 rollout 完成后更新:

T^g new=αTgobs+(1−α)T^g old\hat{T}^{\,\text{new}}_{g} = \alpha T^{\text{obs}}_{g} + (1-\alpha)\hat{T}^{\,\text{old}}_{g}

其中 TgobsT_{g}^{\text{obs}} 是 group gg 的实际 observed assistant turn 数,α\alpha 为 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-basedSuffixDecoding (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 schedulingSec. 3.4:负载依赖的最优策略分析
Model-free speculative decoding利用 GRPO-like 算法中多 trajectory 的 recurring patternsSec. 3.5:cross-prompt + intra-prompt similarity
四维调度评分Cache locality + estimated length + replica load + waiting TTLEq. (3):线性组合四个调度因子
Online estimated assistant turns利用 rollout group 内相似性实时更新长度预测Sec. 3.4:T^g\hat{T}_g 平滑更新公式
Suffix cache 同步机制每步 RL 后将新 trajectories 广播到所有 replicasFigure 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

关键模块:

  1. Global Scheduler:实现 cache-aware scheduling 的四维评分逻辑
  2. SuffixCache Manager:管理历史 trajectory 的存储、匹配和跨 replica 同步
  3. Workload Detector:根据 effective batch size 动态切换 SuffixDecoding 开关
  4. 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 size4, 8, 16, 32, 64(覆盖 low → high load)
Rollout per prompt8 次
训练步骤5 steps
Temperature / top_p / top_k1.0 / 1.0 / 200
Max assistant turns120
BaselineveRL_base(关闭 cache-aware scheduling 和 SuffixDecoding)

实验配置对比

配置Cache-aware SchedulingSuffixDecoding
veRL_base××
sched_only✓×
spec_only×✓
sched_spec✓✓

负载均衡验证(Tab. 1)

所有配置相对于 veRL_base 的工作量差异均值保持在 5% 以内:

Metricsched_onlyspec_onlysched_spec
Prefill tokens2±4%2 \pm 4\%1±2%1 \pm 2\%−2±1%-2 \pm 1\%
Decode tokens1±4%1 \pm 4\%0±4%0 \pm 4\%−2±2%-2 \pm 2\%
Assistant turns1±2%1 \pm 2\%0±2%0 \pm 2\%−1±1%-1 \pm 1\%

End-to-End Evaluation

Prefill Throughput(Figure 4)

Prefill throughput across batch sizes (4-64)

Batch Sizesched_only 改进spec_only 改进sched_spec 改进
4 → 640% → 47%53% → 5%35% → 63%

关键发现:

  • sched_only 随负载增长效果增强(0% → 47%)
  • spec_only 随负载增长效果衰减(53% → 5%)
  • sched_spec 在全负载范围保持 35%~63% 的稳定提升

Decode Throughput(Figure 5)

Decode throughput across batch sizes

Batch Sizesched_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)

End-to-end rollout time reduction across batch sizes

  • SuffixDecoding 主要在 low load 下减少 rollout 时间
  • Cache-aware scheduling 随负载增长提供更大收益
  • 两者结合在所有评估的 batch sizes 上实现一致的端到端加速

总体提升: 低负载下 1.4×,高负载下最高 1.6×

KV-Cache Hit Rate(Figure 7)

KV-cache hit rate across batch sizes

负载veRL_base / spec_onlysched_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)

Average acceptance length of SuffixDecoding

负载spec_onlysched_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 effect on SuffixDecoding throughput

Batch Sizerollout_n=4rollout_n=8
42.72.7
82.65.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-aware scheduling ablation (4 panels)

变体说明性能
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)

禁用 SwaitingS_{\text{waiting}} 相对于启用的影响(% relative difference):

Batch SizePrefill tokensDecode tokensAssistant turnsRollout 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

八、局限性

  1. SuffixDecoding 的高负载退化:当 batch size ≥ 16 时,SuffixDecoding 的 decode throughput 不如非 SuffixDecoding 基线
  2. Waiting factor 的高负载敏感性:禁用 waiting factor 在 batch size=64 时导致 rollout time 恶化 46.9%
  3. 评估规模有限:仅在 500 prompts 的 SWE dataset 上评估,5 training steps
  4. Scaling 未知:在更大规模集群和更长 horizon 任务上的表现待验证
  5. Suffix cache 管理开销:跨 replica 同步 suffix cache 的通信成本未详细分析

九、未来方向

  1. 自适应 workload boundary:动态确定 low/high load 分界点,而非固定 threshold
  2. Learned scheduling policy:用 learnable 的权重替代 hand-crafted scale factors
  3. Cross-dataset evaluation:扩展到 coding、math、general QA 等多种 agent 任务
  4. Suffix cache 压缩:研究高效的历史 trajectory 存储和检索策略
  5. Multi-model support:适配不同规模 LLM 的 rollout 优化

十、总结

核心贡献

  1. Workload-aware 双模式优化:WAR 根据运行时负载自动选择最优策略——低负载用 SuffixDecoding,高负载用 cache-aware scheduling
  2. Model-free speculative decoding:SuffixDecoding 利用 GRPO-like 算法中多 trajectory 的 recurring patterns,无需额外 draft model
  3. 四维调度评分:Cache locality + estimated length + replica load + waiting TTL 的综合调度策略
  4. 即插即用:基于 veRL 实现,约 7K 行 Python 代码,不改变底层 RL 算法
  5. 鲁棒加速:跨全负载范围保持 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 1figures/war/figure-1-WAR-diagram.pngWAR motivation:低负载用 speculative decoding,高负载用 cache-aware scheduling
Figure 2figures/war/figure-2-WAR-architecture.pngWAR 架构:双层 workload-aware 优化控制
Figure 3figures/war/figure-3-WAR-sched-example.pngCache-aware scheduling 示例:two replicas, three queued requests
Figure 4figures/war/figure-4-fig1-prefill-throughput-20260716-212322.pngPrefill throughput across batch sizes (4-64)
Figure 5figures/war/figure-5-fig1-decode-throughput-20260716-212322.pngDecode throughput across batch sizes
Figure 6figures/war/figure-6-fig1-rollout-time-20260716-212322.pngEnd-to-end rollout time reduction
Figure 7figures/war/figure-7-fig2-cache-hit-rate-20260716-215211.pngKV-cache hit rate across batch sizes
Figure 8figures/war/figure-8-cache-aware-scheduling-ablation-20260717-104908.pngCache-aware scheduling ablation (4 panels)
Figure 9figures/war/figure-9-fig2-acceptance-length-20260716-215211.pngAverage acceptance length of SuffixDecoding
Figure 10figures/war/figure-10-suffix-decode-batch-20260717-115907.pngBatch size effect on SuffixDecoding throughput

附表格索引

编号说明
Table 1Workload differences relative to veRL_base(所有配置工作量差异 < 5%)
Table 2Waiting factor ablation(禁用对 rollout 的影响)
Table 3Acceptance length at 1st step under different batch size and rollout_n