Repository navigation
【No.9】 feat(rollout): add stop-reason distribution and turn percentiles - #330
Conversation
80a263a to
10fc164
Compare
|
@SigureMo 任务已完成,请求 review。 |
rai-studio-bot
left a comment
There was a problem hiding this comment.
审查版本:10fc164e(3 个文件、6 个 hunk;CI 全绿,新增测试在 H20 上实际执行并通过)。
停止原因分布与轮数分位数的实现本身没问题:比例分母取当前 samples 总数(各类 ratio 之和为 1)、rollout_turns 缺失时保持默认 1、min/mean/max 行为不变,且只接在 compute_metrics_from_samples 这一既有聚合入口上,没有改动 rollout 主循环与调度。PR 描述的 stop_reason 兼容回退已实现,并有 test_rollout_stop_reason_fallback_and_precedence 覆盖优先级与回退。
两项非阻塞意见见行内评论:
- 回退读取的 agent 侧原因可能是自由文本(如
env_error:<detail>),会原样进入指标名并持续新增序列(P2)。 compute_metrics_from_samples的空输入早退分支在生产调用点不可达,仅影响直接调用者的行为(P3)。
Nyanpasu 审查看板审查状态: ✅ 已通过 审查版本: 752ab2d 已通过 752ab2d 的复核(maintainer 将 main 合入分支触发的新版本)。PR 自身实现与已通过的 681ae83 逐字节一致;本轮增量核对了合并结果:main 对共享文件 relax/utils/metrics/metric_utils.py 的修改(has_repetition 改为 detect_repetition 委托)与新指标无语义冲突、无循环导入,PR 的入口集成测试在 CI 中实际流经合并后的调用路径。新版本 8 项 CI 检查全部通过(含 Python 3.10/3.11/3.12 全量单测与 H20 GPU 单测)。F1、F3 维持已解决,F2、F4 维持已撤回,本轮无新增发现。深度必要性审计(production/tests)均按全 PR 范围完成,结论为保留现有实现;未运行本地定向变异实验(本机无 torch/megatron 环境,记录为缺口,由 CI 实际执行与 F3 回归测试历史佐证)。
审查发现待处理
已解决或已取代
提交范围 · 接收 3 · 建议移出 0 · 待确认 0接收 3 个文件 · 建议移出 0 个文件 · 待确认 0 个文件。移出与待确认部分暂停深审,不代表审查通过。
精简审查与验证依据
生产代码的必要性与替代方案
测试的必要性与替代方案
Powered by Nyanpasu with glm-5.3[1m] xhigh, please check the suggestions carefully.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
辛苦 merge 下最新 main,新增了两条流水线 |
@SigureMo 已 merge 最新流水线,无冲突,CI 全部通过 |
rai-studio-bot
left a comment
There was a problem hiding this comment.
复核 681ae833(含 main 合并):
- F3(agent 侧自由文本停止原因进入指标名)已在
51744804修复,归一化与单测都已验证。 - F2(
compute_metrics_from_samples空输入早退分支)撤回:按 issue #326 原文核对,第 4 节写明「总入口也需要在任何统计和参数读取前处理空输入」,验收标准也要求「辅助函数和总入口对空输入返回{},无统计异常」,且实现范围明确「指标入口的空输入保护及局部字段归一化不属于调度控制改动」——我之前引用的「不新增控制分支」不适用于这条入口保护,保留现有实现是正确的。
本轮新增 1 项非阻塞意见(P2):metadata=None 时新 helper 与 staleness 读取仍会抛 AttributeError,与验收矩阵的「缺失 metadata」「partial 模式缺 metadata」两条必测项不符,详见行内评论。
rai-studio-bot
left a comment
There was a problem hiding this comment.
复核 681ae833 后通过。F1、F3 已解决,F2、F4 已撤回;关于任务范围与 metadata 契约的更正见原线程。目前没有剩余审查问题,7 项 CI 检查通过。本轮未重复运行本地或多节点 GPU 测试。
rai-studio-bot
left a comment
There was a problem hiding this comment.
复核通过(752ab2df)
本轮由 maintainer 将 main 合入分支触发:PR 自身实现与已通过的 681ae83 逐字节一致。增量核对确认合并结果无问题——main 对共享文件 relax/utils/metrics/metric_utils.py 的修改(has_repetition 改为 detect_repetition 委托)与新指标所在区域无重叠、无循环导入,PR 的入口集成测试在 CI 中实际流经合并后的调用路径;新版本 8 项 CI 检查全部通过(含 Python 3.10/3.11/3.12 全量单测与 H20 GPU 单测)。
无新增发现,F1–F4 状态不变;全 PR 范围的生产/测试必要性审计已完成,结论为保留现有实现(详见看板)。
…er-profiler Brings in upstream/main 653c43c..dce533b (redai-studio#257, redai-studio#258, redai-studio#285, redai-studio#323, redai-studio#330, redai-studio#335, redai-studio#408, redai-studio#409, redai-studio#412, redai-studio#414, redai-studio#416, redai-studio#417, redai-studio#419-redai-studio#421, redai-studio#424, redai-studio#426, redai-studio#427, redai-studio#430, and 42 commits synced on 10-12 without PR numbers). The only conflict is relax/utils/env.py: cc4b052 adds the DeepSeek-V4 MXFP4 QAT variables at the same spot where this branch adds the straggler profiler variables. Resolved by keeping both blocks, straggler first.


What
为 Agentic Rollout 增加停止原因分布和轮数分位数指标。
停止原因会按类别分别统计 count 和 ratio,例如:
stop_reason/max_turns/countstop_reason/max_turns/ratiostop_reason/unknown/countstop_reason/unknown/ratio轮数新增:
num_turn/p50num_turn/p90num_turn/p95num_turn/p99同时保留已有的
num_turn/min、num_turn/mean和num_turn/max。停止原因优先读取
rollout_stop_reason;当该字段缺失、为空或无效时,兼容读取现有 Agentic metadata 中的stop_reason。两者均无有效值时统一统计到unknown。Why
Relates to #321.
【No.9】Agentic Rollout 停止原因分布与轮数分位数指标
Task No.9 需要补充 Agentic Rollout 的停止原因计数、占比和轮数分位数,方便观察异常停止情况和长尾轨迹。
项目现有数据路径中同时存在
rollout_stop_reason和stop_reason。聚合时保持任务建议的rollout_stop_reason为主字段,并在主字段无有效值时兼容stop_reason,避免已有 Agentic 停止原因被误统计为unknown。rollout_turns缺失时继续沿用原来的默认值1,停止原因占比以当前 samples 总数为分母。How
compute_rollout_stop_reason_and_turn_metrics聚合停止原因和轮数指标。rollout_stop_reason,主字段无有效值时回退到stop_reason。unknown。rollout_stop_reason优先。Counter统计每种停止原因的 count 和 ratio。np.percentile计算 P50、P90、P95、P99。compute_metrics_from_samples,空输入返回{}。rollout_turns缺失时默认值为1的原有统计语义。unknown、停止原因 fallback 与字段优先级、占比之和、轮数分位数和输入不变性。Testing
Result:
upstream/mainpre-commit run --all-filespassesType of Change
新增 Rollout 指标和对应测试。
Screenshots / Logs
No screenshots. Test output is included above.