You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(grpo): add RLSD self-distilled advantage reweighting
Introduce RLSD (Self-Distilled RLVR) token-level advantage reweighting for
GRPO, enabled via `--advantage_reweight rlsd`. The per-sequence advantage is
redistributed inside each trajectory using the teacher-vs-student logprob gap
as a sign-aware, clipped multiplicative weight, without flipping the reward
sign. The teacher reuses the OPSD self-distillation forward (current policy
conditioned on a privileged `teacher_prompt` column), and a frozen local
teacher via `--teacher_model` is also supported.
- add `apply_rlsd_reweight` in rl_core/advantage.py
- add RLSD args and lambda warmup/decay schedule to the GRPO trainer
- add `_check_rlsd` fail-fast validation in RLHFArguments
- add unit tests in tests/train/test_rlsd_reweight.py
* ci(workflows): add Qoder code review and assistant
* docs(grpo): document RLSD advantage reweighting parameters
Add the new RLSD (Self-Distilled RLVR) CLI parameters to the English and
Chinese command-line references: advantage_reweight, rlsd_lambda,
rlsd_reweight_clip_range, rlsd_lambda_warmup_steps, rlsd_lambda_decay_steps
and rlsd_negative_only, including defaults, valid ranges, the reweight
formula, enable requirements and the two teacher modes.
* update core-review.yaml
Added separate jobs for trusted and external code reviews in GitHub Actions workflow.
---------
Co-authored-by: jinghanhu <hujinghan.hjh@alibaba-inc.com>
Copy file name to clipboardExpand all lines: docs/source_en/Instruction/Command-line-parameters.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -696,6 +696,12 @@ The hyperparameters for the reward function can be found in the [Built-in Reward
696
696
- Note: `gdpo` mode does not support `kl_in_reward=True`. If both are set, `kl_in_reward` will be automatically set to `False`.
697
697
- GDPO is designed for multi-reward optimization: When using multiple reward functions, GDPO normalizes each reward function separately within groups (subtract mean, divide by std), then performs weighted aggregation using `reward_weights`, and finally applies batch-level normalization. This approach better preserves the relative differences between rewards and prevents different reward combinations from collapsing into identical advantage values.
698
698
- teacher_kl_coef: Coefficient for teacher KL in OPD-RL, i.e. `adv_t = base_adv + teacher_kl_coef * teacher_kl`. Default is 1.0.
699
+
- advantage_reweight: Advantage reweighting algorithm. Default is None (disabled). Option: `rlsd` ([RLSD, Self-Distilled RLVR](https://arxiv.org/abs/2604.03128)), which redistributes the per-sequence GRPO advantage across tokens using the teacher-vs-student log-probability gap on the same sampled tokens, i.e. `delta_t = logP_T(y_t) - logP_S(y_t)`, `w_t = exp(sign(A) * delta_t)`, `reweight = (1 - λ) + λ * clip(w_t)`, `A_hat_t = A * reweight`. The reweight is strictly positive and never flips the sign of the environment reward. When enabled it requires `reward_funcs` (the reweight direction uses `sign(A)`) and a `teacher_prompt` column in the dataset (the privileged prompt, e.g. question + reference solution / ground-truth answer); it is incompatible with `use_liger_kernel`, `loss_type in [real, fipo]`, `off_policy_sequence_mask_delta`, and `teacher_model_server`. Teacher modes: without `--teacher_model` it runs dynamic self-distillation (teacher = current policy scored on the privileged prompt); with `--teacher_model <ckpt>` it uses a frozen local teacher (scored under no_grad, never updated during training).
700
+
- rlsd_lambda: RLSD mixing weight, `reweight = (1 - λ) + λ * clip(w_t)`. `0` reduces to plain GRPO, `1` is full RLSD reweighting. Must be in [0, 1]. Default is 0.5.
701
+
- rlsd_reweight_clip_range: Evidence-weight clip range eps_w. Clips `w_t = exp(sign(A) * delta_t)` to `[1 - eps_w, 1 + eps_w]` to prevent overly large multipliers from the teacher/student log-prob gap. Must be >= 0. Default is 0.2.
702
+
- rlsd_lambda_warmup_steps: Number of steps to linearly warm up λ from 0 to `rlsd_lambda`. Default is 0 (no warmup).
703
+
- rlsd_lambda_decay_steps: Number of steps to linearly decay λ from `rlsd_lambda` to 0 after warmup. Default is 0 (no decay; λ stays constant).
704
+
- rlsd_negative_only: Whether to reweight only sequences with negative advantage (`A < 0`, i.e. incorrect responses); sequences with non-negative advantage keep plain GRPO advantages. Default is False.
699
705
- sync_ref_model: Whether to synchronize the reference model. Default is False.
700
706
- ref_model_mixup_alpha: The Parameter controls the mix between the current policy and the previous reference policy during updates. The reference policy is updated according to the equation: $π_{ref} = α * π_θ + (1 - α) * π_{ref_{prev}}$. Default is 0.6.
701
707
- ref_model_sync_steps:The parameter determines how frequently the current policy is synchronized with the reference policy. Default is 512.
0 commit comments