feat(ppo): Megatron value-model sequence packing + context parallelism#2839
Open
bg51717 wants to merge 6 commits into
Open
feat(ppo): Megatron value-model sequence packing + context parallelism#2839bg51717 wants to merge 6 commits into
bg51717 wants to merge 6 commits into
Conversation
Signed-off-by: bg51717 <biguo@nvidia.com>
Signed-off-by: bg51717 <biguo@nvidia.com>
Signed-off-by: bg51717 <biguo@nvidia.com>
Signed-off-by: bg51717 <biguo@nvidia.com>
Signed-off-by: bg51717 <biguo@nvidia.com>
dde8f94 to
b75f7d3
Compare
Signed-off-by: bg51717 <biguo@nvidia.com>
Contributor
Author
|
/ok to test 6cfe536 |
Contributor
Author
|
/ok to test 6cfe536 |
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 does this PR do ?
Adds sequence packing and context parallelism (CP) support to the Megatron PPO value model, building on the in-model value head from PR #2825. Also fixes a value loss-scaling bug (the per-microbatch value loss was averaged instead of summed).
Issues
Closes #2687 (PR 2 of 2). Stacked on #2825 — the base branch is
ppo-mcore-value-headuntil #2825 merges, after which this retargets tomain.Usage
Context parallelism for the value model requires sequence packing (matching Megatron-Core). Both are configured like the policy:
Before your PR is "Ready for review"
Pre checks:
Test
Tests run (all pass):
tests/unit/models/value/test_megatron_value_worker.py, mcore, 2 GPU): packed-unpack (variable-length, CPU), packedtrainstep (incl. PP2), andget_valuesequivalence across SP / dynamic batching / PP / sequence packing / CP (CP=1 vs CP=2, bf16), plus DP/TP regression. 19 passed.tests/functional/ppo_megatron.sh): passes.valuetp2sp-dynbatch(TP2 + SP + dynamic batching; re-validates the loss-scaling fix does not regress convergence): 0.85 / 0.76valuetp2sp-pp2cp2-pack(TP2 + SP + PP2 + CP2 + sequence packing): 0.84 / 0.72