Repository navigation
feat: support sequence packing and context parallelism for DTensor value models - #3320
Conversation
|
/ok to test f778007 |
f778007 to
3789104
Compare
|
/ok to test 3789104 |
3789104 to
4142810
Compare
|
/ok to test 4142810 |
|
/ok to test b4c8662 |
|
/ok to test 94c0444 |
yuki-97
left a comment
There was a problem hiding this comment.
thanks @fujial-code for supporting this, nice work!
left some comments. besides, could you also help to add two nightly tests for sequence packing and CP?
|
@bg51717 could you help to take a review as well? |
bg51717
left a comment
There was a problem hiding this comment.
LGTM. I've left some comments.
|
@yuki-97 Added the two requested nightly tests in 482380f:
Both recipes, launcher scripts, and nightly suite entries are included. I validated the YAML and shell dry runs and also ran the focused 2-GPU worker suite: all 6 CP and sequence-packing training/equivalence tests passed . |
|
/ok to test 482380f |
482380f to
9213306
Compare
|
/ok to test 9213306 |
Self-reviewReviewed the rebased 15-file change at What was verified
Rebase findings resolved
Verification status
No remaining correctness or mixed-version API findings were identified in the current diff. |
|
/ok to test f30176f |
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
Signed-off-by: fujial <[email protected]>
aca676f to
e429d72
Compare
|
/ok to test e429d72 |
Signed-off-by: fujial <[email protected]>
|
/ok to test 00cfdbc |
Signed-off-by: Yuki Huang <[email protected]>
|
/ok to test 7a77c66 |
|
/ok to test 1495948 |
Signed-off-by: fujial <[email protected]>
|
/ok to test 3448605 |
Main's #3320 removed the is_reward_model parameter from prepare_model_forward and dropped it at the five existing call sites. The PR's get_topk_logits_ipc call merged without a textual conflict and still passed is_reward_model=False, so its first teacher microbatch would raise "TypeError: prepare_model_forward() got an unexpected keyword argument 'is_reward_model'". That is the CSD path for an Automodel student with teacher_topk_ipc_k > 0 (128 by default). Drop the keyword so the call matches the other five. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adithya Hanasoge <[email protected]>
What does this PR do?
Adds sequence packing and context parallelism support to the DTensor/FSDP2 PPO value-model path.
This follows the DTensor PPO value-model support introduced in #2837 and closes the two missing features tracked in #2951.
The main correctness work is specific to scalar token-level value predictions:
Sequence packing and context parallelism are supported as independent modes. Their existing mutual-exclusion validation remains in place.
Issues
Closes #2951
Summary of Changes
DTensor Value Sequence Packing
ScorePostProcessorto reconstruct padded per-sample value tensors from packed outputs using:cu_seqlensfloat16orbfloat16precision because FlashAttention does not supportfloat32inputs.DTensor Value Context Parallelism
2 * context_parallel_size, as required by load-balanced causal CP attention.num_attention_heads != num_key_value_headsfloat16orbfloat16precision for CP.Configuration and Compatibility
Tests
Added or extended coverage for:
Validation
Validated with the Qwen2.5-1.5B-Instruct GSM8K PPO setup on one 8-GPU node.
Both comparisons resume from the same value-model checkpoint so differences cannot be attributed to random value-head initialization.
Sequence Packing OFF vs ON
Ran a 100-step PPO comparison with matched settings:
Results:


train/rewardfollows the same learning trajectory.train/critic/lossclosely overlaps across training.Context Parallelism OFF vs ON
Ran a 100-step PPO comparison with matched settings:
Results at step 100:


train/reward0.89550.9023train/critic/loss0.031470.03260Both runs complete successfully, and the reward and critic-loss behavior remain aligned.
train/lossis the policy loss and is not expected to remain pointwise identical after the stochastic rollout trajectories diverge. The correctness checks for this PR therefore use pinned deterministic value inference/train-loss equivalence together with reward and critic-loss behavior.Local Checks