正则化重要性采样下策略梯度估计的基线与得分中心化分析
Baselines and Score Centering in Policy Gradient Estimation
做 RL 后训练的朋友可以看看,讲清楚了 GRPO 那套 group-mean baseline 什么时候够用、什么时候会引入偏差。
这篇笔记研究 RL 后训练 LLM 时的策略梯度估计。在采用截断、掩码或裁剪等正则化重要性采样的情况下,重要性加权策略梯度对奖励的常数平移不再保持不变性。作者提出改用奖励与重要性加权得分之间的协方差作为估计对象,在比率未正则化时与策略梯度一致。笔记分别推导了序列级与 token 级重要性采样的情形,并说明:序列级采样下使用组均值基线后得分中心化无额外收益,token 级采样下只用组均值基线而不做得分中心化一般会引入偏差。
Baselines and Score Centering in Policy Gradient Estimation
Reinforcement learning has become a widely used approach to post-training large language models. In a typical implementation, learning is off-policy: The policy generating the responses differs from the policy being trained because of training-inference mismatch or policy staleness in asynchronous training. This discrepancy is commonly addressed by importance sampling, whose ratio is usually regularized in practice through truncation, masking, or clipping. Under regularized importance sampling, the importance-weighted policy gradient is no longer invariant to constant shifts in the reward. This invariance is recovered by using the covariance between the reward and the importance-weighted score as the estimand, which coincides with the policy gradient when the ratio is not regularized. This note develops this covariance perspective for both sequence-level and token-level importance sampling. The covariance perspective reveals the roles of the group-mean baseline and score centering in policy gradient estimation. Both perform centering in covariance estimation, but they differ in the mean being subtracted: The group-mean baseline uses a sample mean, whereas score centering uses a population mean. The two lead to distinct unbiased covariance estimators with different variances. Whether both forms of centering should be used simultaneously depends on whether importance sampling is applied at the sequence level or at the token level. With sequence-level importance sampling, score centering adds no benefit once the group-mean baseline is used; with token-level importance sampling, using the group-mean baseline without score centering generally introduces bias when the importance ratio is regularized.