Skip to content

Add OPSD (On-Policy Distillation) training example#1002

Open
delock wants to merge 10 commits into
masterfrom
gma/opsd
Open

Add OPSD (On-Policy Distillation) training example#1002
delock wants to merge 10 commits into
masterfrom
gma/opsd

Conversation

@delock

@delock delock commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR moved example code from @PKUWZP 's OPSD PR in DeepSpeed (deepspeedai/DeepSpeed#8027).

Note the basic OPSD infrastructures (OPSD trainer, rollout engines) are still in the original PR and need to be merged seperately. This PR will work when the original PR merged.

@delock delock requested a review from tjruwase as a code owner June 24, 2026 09:30
Comment thread training/opsd/configs/opsd_vllm_disjoint.json Outdated
Comment thread training/opsd/configs/opsd_vllm_disjoint.json Outdated
Comment thread training/opsd/configs/opsd_hybrid_engine.json
@delock

delock commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi @tjruwase I have changed according to your first and second comments. For the third comment, I left an explaination. Thanks!

delock added 2 commits July 2, 2026 10:34
Entry point, configs, data, and tests for on-policy distillation
using DeepSpeed's hybrid engine rollout and vLLM backend.

Signed-off-by: Guokai Ma <guokai.ma@intel.com>
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
…m_dtype to engine_dtype

Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
Comment thread training/opsd/README.md Outdated
```
examples/opsd/
├── main.py # entry point (deepspeed launcher)
├── opsd/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this folder structure exists in DS not DSE, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the folder should start from training/opsd, I'll update them

delock added 6 commits July 3, 2026 17:51
…DeepSpeed

- Delete vLLM configs, scripts (opsd_vllm_disjoint.json, smoke_vllm.json, train_opsd_vllm.sh)
- Add trainer.py, config.py, losses.py, utils.py (moved from DeepSpeed)
- Add benchmarks/ (5 hybrid engine benchmarks moved from DeepSpeed)
- Update main.py imports (trainer, config now local)
- Update test imports (losses, utils now local)
- Rewrite README (remove all vLLM sections)

Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
…ants from JSON

- Subclass DeepSpeed's RolloutConfig to add temperature/top_p/etc
- Remove weight_sync_interval from JSON configs (vLLM remnant)

Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
…per fix

- Remove 14B/multi-GPU benchmarks (bench_14b_rollout, bench_autotp_gc,
  bench_hybrid_tp, bench_hybrid_tp_opt)
- Fix bench_decode_1p1r: wrap model for HybridEngineRollout
- Add --graph-capture CLI flag

Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
…nfigs

temperature=0 causes logits/0 = inf → NaN loss. The correct default
for knowledge distillation is temperature=1.0 (standard softmax).

Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
Comment thread training/opsd/teacher.py
for p in model.parameters():
p.requires_grad_(False)

if cfg.offload_to_cpu:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean deepspeed is only enabled when offload_to_cpu==True?
Why not

  1. Always enable deepspeed
  2. ds_config["zero_optimization"]["offload_param"]["device"] == "cpu" if cfg.offload_to_cpu else None

delock added 2 commits July 12, 2026 22:45
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
Signed-off-by: Guokai Ma <guokai.ma@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants