perf(distillation): defer teacher top-k Ray payloads - #3943
Open
yuchenwang3 wants to merge 1 commit into
Open
Conversation
Keep DP-local teacher outputs in the Ray object store and hand their references directly to matching student workers. Materialize only small worker wrappers in the driver so all-replica readiness and error propagation remain unchanged. Refs: NVIDIA-NeMo#1877 Signed-off-by: Yuchen Wang <93700456+yuchenwang3@users.noreply.github.com>
Author
|
@nvidia-nemo/rl_reviewers_algo @nvidia-nemo/rl_reviewers_infra — final validation is complete on head |
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?
Keep DP-local teacher top-k payloads in the Ray object store and pass their references directly to matching student workers instead of materializing the large tensors in the driver.
The fast path is enabled only when teacher and student have compatible static DP layouts. Dynamic batching, mismatched DP sizes, incompatible sequence-packing layouts, and partial batches continue to use the existing materialized path.
Worker methods return a small wrapper containing the worker-local payload reference. The driver still materializes every wrapper, so failures from replicated workers propagate before representative payload references are selected. Ray sharding also preserves existing ObjectRefs rather than wrapping them in another object-store entry.
Issues
Closes #1877
Usage
No user-facing configuration change is required. Compatible distillation runs select the deferred transfer path automatically.
Validation
Exact source under test:
71a08314bc3257a15ef04b507309649e3d3f0f6820cfa59cc405067629d1c99562f10687f396bfb3036dd95966651201da0998d009f939dbec630815Focused tests:
tests/unit/models/policy/test_deferred_topk.py: 8 passed, 0 skippedtests/unit/distributed/test_worker_groups.py: 28 passed, 1 unrelated Nsight environment skiptests/unit/algorithms/test_distillation.py: 23 passed, 0 skippedControlled 8×B200 Ray transfer benchmark:
Every measured run used 8 actors, completed all repeats with exit 0, matched checksums, resolved ObjectRefs automatically, and reported zero object spilling. The final-patch harness models the production path: worker-local
ray.put, small wrapper materialization in the driver, then direct payload-reference handoff. A separate probe confirmed that an error from a non-representative worker still fails the driver.This is a controlled transfer benchmark for the bottleneck mechanism rather than a claim about full end-to-end training-step speedup.
Local checks also passed: Ruff lint, Ruff format check, Python compileall, and
git diff --check.Before your PR is "Ready for review"
Additional Information
The commit is signed off under DCO by Yuchen Wang.