Skip to content

FastSAC learner bf16 AMP 在 sm86 消费卡上静默毁掉训练(g1-wbt-dance reward 停滞) #71

Description

@wlgys8

FastSAC learner bf16 AMP 在旧架构消费卡上静默毁掉训练

现象

g1-wbt-dancemotrix.fastsac,默认配置,seed=1)在 Ryzen 7 9700X + RTX 3060 Ti 8GB(sm86)上 reward 永远不涨;同样配置在 Ryzen 9 9950X + RTX 5090 上正常训练。CPU 侧性能、collector 吞吐、UTD(≈3.99)、ring/权重同步均正常——失败完全静默:不报错、不 NaN,只是学习停滞。

伴随症状(bf16 失败 run vs 正常 run):

  • alpha 死卡在初始值 0.001,不自调;正常 run 会降到 ~6.9e-4
  • policy_entropy 塌到 -17.2;正常 run 收敛到 target ≈ -14.2(-action_dim × 0.5)
  • rollout/mean_return 在 ~14M env steps 后仍 ≈ -0.5;正常轨迹 5M steps 时应到 +3 左右(参考 docs/source/_static/data/performance/g1-wbt-dance.json 基准曲线)
  • actor_loss 差异是结果而非原因

复现与二分(同机同 seed,3000 iters ≈ 6M env steps)

配置 3000 iters 时 mean_return 备注
默认(bf16 AMP + compile + collector fp16) -0.55 ~ -1.05 完全停滞;另一次 6800 iters 仍 -0.5
algo.agent.amp=false(compile、collector fp16 保留) +1.39 学习正常,alpha 正常自调
amp=false + compile=false + collector fp32 +2.20 学习正常
algo.agent.amp_dtype=fp16 -2.23 也不行,且 learner 进程一次 abort(exit -6,8GB VRAM 边缘)

复现命令(约 3–7 分钟):

# 停滞(sm86 上)
python scripts/train.py task=g1-wbt-dance/motrix.fastsac \
  algo.asynchronous=true algo.trainer.num_learning_iterations=3000

# 正常
python scripts/train.py task=g1-wbt-dance/motrix.fastsac \
  algo.asynchronous=true algo.trainer.num_learning_iterations=3000 algo.agent.amp=false

初步归因(待验证)

learner 的 bf16 autocast 精度不足。本任务每步 reward 量级 ~0.08,而 C51 critic(v_min/v_max=-20..20num_atoms=501)的 atom 间距恰好也是 40/500 = 0.08;Q 值 ~10 时 bf16 分辨率 ~0.06,与 TD 信号同量级,梯度/分布更新可能被量化吞掉。5090(Blackwell)上同样的 bf16 配置可正常训练,推测是不同 arch 的 kernel/累加路径差异,但根因尚不确定是 C51 projection、alpha 还是 actor 梯度被量化,需要定位。

注意根因可能不纯是 arch:任何低 reward 尺度 + 细 atom 间距的任务理论上都可能在任意 GPU 上踩中,只是尚未暴露。

待办

  • 定位被量化的具体路径(C51 projection / alpha 更新 / actor 梯度),可对比 fp32 vs bf16 的逐阶段梯度
  • 决策默认值:建议 amp 默认改 false(静默失败不可接受,AMP 收益约 1.7× learner 提速属可选优化),或改为按 arch 自动探测
  • 评估对 C51 projection / alpha 路径强制 fp32 的修复方案
  • wiki/research/fastsac-gpu-analysis.md 补充本负结果

相关

  • 默认配置:configs/algo_base/motrix.fastsac.yamlamp: trueamp_dtype: bf16
  • 实验证据 run:runs/g1-wbt-dance/motrix/torch/fastsac/26-09-21_21-{16-59,23-49,27-12,34-25,39-29}*

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions