[ray_trainer] function **apply_kl_penalty** bug
https://github.com/volcengine/verl/blob/main/verl/trainer/ppo/ray_trainer.py#L173
In the function apply_kl_penalty, the update of kl_ctrl is kl_ctrl.update(current_kl=current_kl, n_steps=batch_size) where n_steps should represent the currently trained step number.
according to https://github.com/huggingface/trl/blob/951ca1841f29114b969b57b26c7d3e80a39f75a0/trl/trainer/ppo_trainer.py#L837, there are:
self.kl_ctl.update( stats["objective/kl"], self.config.batch_size * self.accelerator.num_processes, ),
I think n_steps should not be batch_size, it should be global_steps, and horizon in kl_ctrl should also be synchronously aligned with the entire training step instead of a fixed value.
I think it’s because verl uses a single-controller architecture, so the “batchsize” here is just the global batch size.
I think it’s because verl uses a single-controller architecture, so the “batchsize” here is just the global batch size.
I have carefully read the description of the Adaptive KL controller in this paper:
https://arxiv.org/pdf/1909.08593.pdf
Models trained with different seeds and the same KL penalty $\beta$ sometimes end up with quite different values of $\text{KL}(\pi, \rho)$, making them hard to compare. To fix this, for some experiments we dynamically vary $\beta$ to target a particular value of $\text{KL}(\pi, \rho)$ using the log-space proportional controller: $$ e_t = \text{clip}\left(\frac{\text{KL}(\pi_t, \rho) - \text{KL}{\text{target}}}{\text{KL}{\text{target}}}, -0.2, 0.2\right) $$ $$\beta_{t+1} = \beta_t(1 + K_\beta e_t)$$ We used $K_\beta = 0.1$.
In the original paper, $K_\beta$ is set to a constant value of 0.1, but in the verl and trl implementations, it is set to n_steps / self.horizon. In this way, it seems to conform to the conclusion of it being a constant value, but I am not sure why this ratio is set. I would be grateful for an explanation.
中文
根据本次定时任务对 comments 和 timeline 的检查,这个 issue 命中默认超时关闭规则:最近一次非当前运行账号(Kirrito-k423)的公开回复或公开引用是 2025-06-13T03:45:23Z,已经超过 6 个月。证据:latest_non_self_reply_or_reference_at=2025-06-13T03:45:23Z; kind=comment; actor=zhaojingqian; reference=https://github.com/verl-project/verl/issues/1984#issuecomment-2968932875。检查来源:https://api.github.com/repos/verl-project/verl/issues/1984/comments 和 https://api.github.com/repos/verl-project/verl/issues/1984/timeline。因此按定时清理标准先关闭;如果作者或社区成员仍能提供新的复现、证据或需求背景,可以继续评论请求重开或创建新 issue。
English
In this scheduled pass, I checked the issue comments and timeline. This issue matches the default stale-issue closure rule: the latest public reply or public reference from an account other than the current runner (Kirrito-k423) was at 2025-06-13T03:45:23Z, which is more than 6 months ago. Evidence: latest_non_self_reply_or_reference_at=2025-06-13T03:45:23Z; kind=comment; actor=zhaojingqian; reference=https://github.com/verl-project/verl/issues/1984#issuecomment-2968932875. Checked sources: https://api.github.com/repos/verl-project/verl/issues/1984/comments and https://api.github.com/repos/verl-project/verl/issues/1984/timeline. I am closing it under the scheduled cleanup rule. If the author or community can provide a fresh reproduction, evidence, or requirement context, please comment to request reopening or open a new issue.
This response was generated by a scheduled Codex GPT5.5 issue processing task.