feat(algorithm): add PKPO pass@k advantage estimator (arXiv:2505.15201)#743
Open
jeffreysijuntan wants to merge 1 commit into
Open
feat(algorithm): add PKPO pass@k advantage estimator (arXiv:2505.15201)#743jeffreysijuntan wants to merge 1 commit into
jeffreysijuntan wants to merge 1 commit into
Conversation
Adds `adv_estimator: pkpo`, a per-group reward transform that optimizes pass@k. Each sample is credited with (1/C(n,k)) * sum over k-subsets containing it of the subset max -- the unbiased pass@k/max@k gradient -- then mean-centered. Reduces to standard mean-centered reward at k=1 and matches the binary Theorem 2 form (correct -> k/n, incorrect -> (k/n)*rho(n-1,c,k-1)). Works on binary or continuous rewards. - rl_algo.py: calculate_pkpo_advantages_per_group + _comb helper - advantage.py: register `pkpo` estimator (reads algorithm.pass_at_k) - config.py: PKPO enum member + pass_at_k field - base.yaml: pass_at_k key - tests: numeric transform tests + config resolution Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds
adv_estimator: pkpo— a per-group reward transform that optimizes pass@k instead of mean reward (Pass@K Policy Optimization, arXiv:2505.15201).How it works
For each problem's group of
nrollouts, every sample is credited withthe unbiased estimator of the pass@k / max@k gradient, then mean-centered to form the advantage. Uses the new
@rllm.register_adv_estimatorhook, so it composes with every backend and downstream loss.Properties (all covered by tests):
k/n, incorrect →(k/n)·ρ(n−1,c,k−1)); e.g.n=4, c=2, k=2gives ±1/12.kis clamped to[1, n].Config
Changes
rl_algo.py—calculate_pkpo_advantages_per_group+_combhelperadvantage.py— register thepkpoestimator (readsalgorithm.pass_at_k)config.py—PKPOenum member +pass_at_kfield (read infrom_config)base.yaml—pass_at_kkeytests/unified_trainer/test_pkpo.py— numeric transform teststests/unified_trainer/test_algorithm_config.py— config-resolution testsTests
test_pkpo.py+test_algorithm_config.pypass (16). Verified end-to-end through the registry +AlgorithmConfig(adv_estimator=pkpo,pass_at_k=2).test_config_sync.pyerrors locally only becauseverlisn't installed in this env (pre-existing, unrelated).Base branch
Targets
terminal-rl(builds on@rllm.register_adv_estimatorfrom #742).🤖 Generated with Claude Code