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

オープン
#10,587 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
16.2k
フォーク
1.8k
平均マージ
1日 14時間
マージ済み PR(30日)
68

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelscope/ms-swift のほかの issue

modelscope/ms-swift の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。