Skip to content

Harden rollout abort and routed experts handling#1827

Open
YanhuiDua wants to merge 3 commits into
InternLM:mainfrom
YanhuiDua:fix_abort_3
Open

Harden rollout abort and routed experts handling#1827
YanhuiDua wants to merge 3 commits into
InternLM:mainfrom
YanhuiDua:fix_abort_3

Conversation

@YanhuiDua
Copy link
Copy Markdown
Collaborator

@YanhuiDua YanhuiDua commented May 22, 2026

这个 PR 主要修复 rollout pause/abort 在高并发异步 RL 训练中的收尾问题,并拆成三类改动:

  1. 增强 abort_request 的可靠性

    • 在 RL trainer 初始化阶段根据 train_batch_size * prompt_repeat_k * (1 + over_sample_threshold) / rollout_workers 检查所需 HTTP 并发如果当前 allow_over_concurrency_ratio 不足,会自动调大并打印 warning
    • rollout worker 收到 abort 后,如果已有 HTTP response 返回,不再直接丢弃 response,而是正常解析 response,然后把 statusfinish_reason 标记为 ABORTED,避免 abort 后完成的 response 被误当成 completed sample,然后继续 judge
    • 对 abort 后仍未返回的 HTTP client task 增加 cancel/drain timeout,避免本地 cancel 卡住。
    • producer cleanup 超时后会强制 cancel 剩余 pending rollout tasks,并用 drain timeout 收口,避免 pause 卡死。
    • producer 在等待 pending tasks 回收期间周期性补发 abort,覆盖 abort 后才到达 LMDeploy 的少量请求。
    • 对 HTTP client task、pending rollout task、judger pause 都加 timeout/drain,避免任何一个环节无限阻塞 pause。
  2. 支持 judger abort

    • AgentLoop.pause() 统一触发 rollout pause 和 judger pause。
    • 如果 group 中存在 aborted sample,会跳过 judge,避免 abort 后的样本继续进入 batch judge 导致 pause 尾部卡住。
      - 新的修复:不在Judger中定义pause方法,如果在基类写pause方法,没办法做到每个judger都能用,为了简化judger的用法,所以在 SingleTurnAgentLoop中将调用judger作为可取消的
  3. 修复 routed experts 的返回与清理

    • return_routed_experts 改为同时受全局 enable_return_routed_experts 和 request-level sample_params.return_routed_experts 控制,评估请求关闭 routed experts 返回
    • filtered sample 入 replay buffer 前会清理 response/routed experts,减少无效样本持有大对象。

@YanhuiDua YanhuiDua force-pushed the fix_abort_3 branch 6 times, most recently from f2baeba to b4baa80 Compare May 22, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant