Skip to content

unilab.rl 与 uni_rl 重复实现(dp_launcher / rsl_rl 助手)的漂移风险:需明确属主并加契约测试 #1623

Description

@TATP-233

背景

#1621(分支 feat/issue-1621-ppo-direct-rsl-rl)把 PPO 改为直驱上游 rsl-rl、unilab-rl 降级为可选 extra。为了让单进程 PPO 不依赖 uni_rl,src/unilab/rl/distributed.pysrc/unilab/rl/vec_env.py 复制/封装了 uni_rl 的若干实现,两侧可独立漂移:

uni_rl/ipc/dp_launcher.py 重复或强耦合:

  • resolve_dp_topologyvalidate_dp_launchablecurrent_torch_distributed_rank/local_rank/world_size 为逐行副本;
  • UNILAB_DP_LOG_DIR 常量两侧各定义一次——该字符串是跨进程契约(uni_rl launcher 设置,UniLab worker 读取),任何一侧改名即静默断链;
  • resolve_collector_cpu_ids / launch_torchrun_workers 为懒加载委托,签名与 uni_rl 侧强耦合但无编译期/CI 检查。

uni_rl/algos/rsl_rl.py 重复:

  • apply_rsl_rl_rank_seedresolve_rsl_rl_deviceppo_samples_per_iterationfinish_rsl_rl_distributedrsl_rl_single_process_topology(uni_rl 侧已随 PPO 封装层一并删除,见 unilab_rl 仓库 chore/remove-rsl-rl-ppo-layer 分支);
  • RslRlVecEnvAdapter / get_policy_obs_dims 与 uni_rl 保留的 RslRlVecEnvWrapper(APPO 链路仍在消费)语义近似,观测拼接与 done/timeout 语义可独立漂移。

unilab-rl==1.3.0 为精确 pin,当前无实际漂移;风险在于未来 bump pin 后两侧静默不一致——多卡 PPO 与 APPO 回放只在使用时才触发,单进程 CI 覆盖不到。

建议

  1. 在 UniLab 为 uni_rl.ipc.dp_launcher 的消费面(launch_torchrun_workersresolve_collector_cpu_idsUNILAB_DP_LOG_DIR)加契约测试(inspect.signature 比对 + 常量比对),仅在 uni_rl 安装时运行(dev 组/CI 已装)。
  2. 明确每个重复符号的唯一属主并在两侧 AGENTS.md 记录;与 跨边界重复工具模块需明确唯一属主(nan_guard/tensor/seed/device) #1586 的属主决策一并处理。
  3. 在 bump unilab-rl pin 的 PR 检查单中加入「核对 dp_launcher 消费面」一项。

证据

  • UniLab 侧副本:src/unilab/rl/distributed.pysrc/unilab/rl/vec_env.py(分支 feat/issue-1621-ppo-direct-rsl-rl)。
  • uni_rl 侧原件(1.3.0):src/uni_rl/ipc/dp_launcher.pyresolve_dp_topology L35、resolve_collector_cpu_ids L106、validate_dp_launchable L223、launch_torchrun_workers L264、UNILAB_DP_LOG_DIR L24)、src/uni_rl/algos/rsl_rl.py
  • uni_rl 侧 PPO 封装层删除:unilab_rl 仓库分支 chore/remove-rsl-rl-ppo-layer

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions