Repository navigation
feat(trainer): add composable advantage computation - #1784
Merged
Merged
Conversation
Allow independent outcome, temporal, and process advantage plugins while preserving the default GAE kernels and existing PPO/PRM behavior. Keep logical rollout normalization references in the same reward units as custom shaping and validate plugin outputs before training. Add CPU, distributed, CUDA, and configuration compatibility coverage, plus English and Chinese customization documentation. Signed-off-by: Xujie Shen <shenxujie.sxj@antgroup.com>
fishcrap
marked this pull request as ready for review
October 14, 2026 09:31
fishcrap
requested review from
Le8r0nJames,
daihaowz,
garrett4wade,
sitabulaixizawaluduo and
yulangz
as code owners
October 14, 2026 09:31
7 of 9 tasks
Le8r0nJames
previously approved these changes
Oct 14, 2026
Preserve upstream R3 imports and replay integration alongside the extracted advantage pipeline. Signed-off-by: Xujie Shen <shenxujie.sxj@antgroup.com>
sitabulaixizawaluduo
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduce a composable advantage computation pipeline through
actor.advantage. Users can override outcome reward shaping, temporal estimation, process advantage shaping, or the complete computation with a built-in implementation or a dotted callable and serializable arguments.The default pipeline reuses the existing GAE kernels and preserves PPO, PRM, and MOPD behavior, logical rollout normalization, truncation handling, and optimizer scheduling. Existing PRM configuration remains supported; explicit advantage-stage settings take precedence.
Custom outcome shaping can provide logical reward references in the same units as the shaped rewards. Plugin results are validated for shape, device, dtype, finite values, binary masks, and permitted field updates. English and Chinese documentation describe configuration, extension contracts, and compatibility behavior.
Related Issue
Follow-up to #1782. No dedicated issue is associated with this change.
Type of Change
Validation
pre-commit run --all-filesand./docs/build_all.shpassed. Existing documentation warnings are outside the changed pages.Regression command:
python -m pytest tests/test_advantage_pipeline.py tests/test_advantage_pipeline_cuda.py tests/test_advantage_algorithms.py tests/test_ppo_gae.py tests/test_token_rewards_advantage.py tests/test_reward_norm_variable_group.py tests/test_logical_rollout_groups.py tests/test_ppo_actor_truncation.py tests/test_training_diagnostics.py tests/test_mopd_compatibility.py tests/test_prompt_mean_actor.py tests/test_prm_config.py tests/test_prompt_mean_loss.py tests/test_ppo_actor_controller.py tests/test_ppo_stats.py tests/test_mopd_config.py tests/test_mopd_loss.py tests/test_incomplete_rollout_groups.py tests/test_prm_config_validation.py tests/test_logical_rollout_distributed.py --basetemp="$(mktemp -d)/pytest" -qThe distributed parity run preceded the final configuration and input-validation guards. The final revision passed the complete targeted suite and a fresh end-to-end run. FSDP and Archon end-to-end training and MTP were not included in this validation; training-engine and loss implementations are unchanged.
Checklist
pre-commit run --all-files)./docs/build_all.sh)main/review-prcommand/create-prAdditional Context
The main review areas are collective ordering during logical reward normalization, preservation of GAE/PRM computation order, and configuration precedence. This change is limited to advantage computation; efficiency presets, loss plugins, data hooks, and scheduler changes are outside its scope.