feat(distillation): add on-policy distillation using RolloutEngine#1376
Open
zahrayousefijamarani wants to merge 5 commits into
Open
feat(distillation): add on-policy distillation using RolloutEngine#1376zahrayousefijamarani wants to merge 5 commits into
zahrayousefijamarani wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a rollout-based teacher engine type for inference-only teacher distillation using vLLM or SGLang, deprecating the legacy train-engine teacher path. It implements token log-probability computation across remote engines, controllers, and the trainer. The review feedback identifies a missing pipeline parallel size parameter in the SGLang teacher configuration and recommends adding defensive checks when parsing API responses from vLLM and SGLang servers to prevent potential runtime errors.
Collaborator
|
Small changes to add:
|
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
Summary
This PR enables on-policy distillation with a dedicated teacher rollout/inference engine (vLLM/SGLang), instead of relying on a train-engine teacher path.
The goal is to reduce memory overhead and provide a clean inference-side token log-prob scoring API used by distillation losses.
Motivation
In on-policy distillation, teacher is used for teacher_logp scoring only.
A full train-engine teacher can allocate unnecessary training-state memory (optimizer/grad-related structures), while rollout/inference teacher is lighter and better aligned with the actual use case.
Related Issue
Fixes #1367
Type of Change
Checklist
pre-commit run --all-files)./docs/build_all.sh)main/review-prcommand/create-prBreaking Change Details (if applicable):
Additional Context
What changed
1) Teacher config refactor
TeacherConfigno longer inherits train-actor config.rollout: InferenceEngineConfigpath: stroffload: boolrl_loss_weightdistill_loss_weight2) Inference scoring API
InferenceEngine.compute_logp(...)API.build_score_request(...)parse_score_response(...)3) Remote scoring implementation
Implemented
compute_logpinRemoteInfEngine:Added passthrough implementations in:
RemotevLLMEngineRemoteSGLangEngineBackend-specific score request/response logic added for:
4) Controller integration
RolloutController.compute_logp(...)so trainer can call scoring via controller mode.5) Trainer integration
RLTrainernow supports dedicated teacher rollout initialization via_init_teacher_rollout(...).teacher.compute_logp(rollout_batch)teacher_logprl_loss_weightdistill_loss_weightAdded compatibility guards:
close()6) Docs / examples
teacher.pathteacher.rolloutNeed help? Check the Contributing Guide or ask in
GitHub Discussions!