[Feature] Self-Distillation Policy Optimization (SDPO) for Megatron GRPO

Aperta
#10,587 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start by reading the existing Megatron GRPO rollout, reward, advantage, and loss paths, then compare the proposed behavior with the linked SDPO paper and reference implementation. The request spans a fused Triton loss, EMA teacher checkpointing, reward feedback and generation APIs, backend handling, docs, an example, and tests. Done means those pieces work together with the listed parallelism modes and unsupported cases fail clearly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Checklist / 检查清单
  • I have searched existing issues, and this is a new feature request. / 我已经搜索过现有的 issues,确认这是一个新的 Feature Request。
Feature Request Description / Feature Request 描述

SDPO (Hübotter et al., 2026, "Reinforcement Learning via Self-Distillation") is a GRPO variant for tasks where the environment returns rich textual feedback (runtime errors, judge comments, ...) besides a scalar reward. The same policy, reprompted with a successful sibling rollout and/or the feedback of its own attempt, acts as its own teacher: its next-token distributions are distilled into the policy on the policy's own sampled responses. No external teacher or reward model is needed, and the advantage term is replaced by a distillation loss (generalized JSD over the student's top-K tokens plus a tail bucket). The authors' reference implementation (https://github.com/lasgroup/SDPO) is verl-based research code; this would be an independent implementation on the Megatron backend.

I would like to add it to the Megatron GRPO backend, reusing the existing GRPO rollout/reward/advantage code:

  • --loss_type sdpo for megatron rlhf --rlhf_type grpo, with a fused Triton LM-head loss (no full logits materialised), supporting DP / TP (sequence parallel, padding-free) / PP / EP and full fine-tuning; an EMA teacher that reuses the reference-model slot (fp32 master in host RAM, saved with checkpoints).
  • Reward functions may return {'rewards': [...], 'feedback': [...]} (plain lists keep working for every GRPO variant).
  • --reward_rollout_generator: reward functions receive a handle to generate text with the policy's own vLLM (colocated or server), e.g. to write the feedback.
  • --sdpo_grpo_weight: the SDPO + GRPO mix of the paper (Section 4.5).
  • English and Chinese docs (translated using Claude Sonnet 5.5), an example plugin and script, unit tests.

The HF/transformers backend would raise a clear NotImplementedError for now; context parallel, LoRA with the EMA teacher and the trust-region teacher of the paper are not part of the first version.

Pull Request / Pull Request 信息

I plan to submit one pull request with the above (I will link this issue). It is developed with AI assistance and I reviewed every changed line myself.

Lingua principale
Python
Stelle
16.2k
Fork
1.8k
Merge medio
1g 14h
PR unite (30g)
68

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelscope/ms-swift

Tutte le issue di modelscope/ms-swift

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.