Skip to content

Add a multi-teacher distillation notebook with DistillationTrainer - #8685

Closed
behroozazarkhalili wants to merge 1 commit into
huggingface:mainfrom
behroozazarkhalili:add-distillation-mopd-example
Closed

behroozazarkhalili wants to merge 1 commit into
huggingface:mainfrom
behroozazarkhalili:add-distillation-mopd-example

Conversation

@behroozazarkhalili

@behroozazarkhalili behroozazarkhalili commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

This adds examples/distillation_mopd/distillation_mopd.ipynb and its row in the examples overview.

The notebook distills a math teacher and a code teacher into one Qwen2.5-0.5B student with DistillationTrainer, routing each prompt to its teacher. In the committed run the student goes from 48.5% to 51.5% on GSM8K and from 38.0% to 42.0% on MBPP. Training takes 34 minutes and peaks at 15.9 GB of GPU memory, so it does not fit a free Colab T4 as configured; the overview row says so.

The outputs come from one end-to-end run.


Note

Low Risk
Adds a notebook and one overview table row only; no runtime or trainer implementation changes.

Overview
Adds examples/distillation_mopd/distillation_mopd.ipynb, an end-to-end walkthrough of multi-teacher on-policy distillation with DistillationTrainer (TRL 1.19+): a Qwen2.5-0.5B student, math and code Qwen2.5 teachers on GSM8K and MBPP, routing via a teacher_id column and a teacher dictionary. The notebook covers dataset prep, tokenizer checks, pre/post divergence and task metrics (GSM8K / MBPP), training (~15.9 GB peak), smoke-test mode, and optional Hub push; committed outputs are from one full run.

docs/source/example_overview.md gains an index row for distillation_mopd, noting the ~15.9 GB peak so it is not runnable on free Colab as configured (no Colab badge).

This is documentation and example only; no changes to library training code.

Reviewed by Cursor Bugbot for commit 4ec1407. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

bot-ci-comment Bot commented Dec 1, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Pages changed in this PR:

@sergiopaniego

Copy link
Copy Markdown
Member

Closing, see #8686 (comment). Multi-teacher distillation is covered by the "multiple teachers" docs section and async_distillation_mopd (AIME24 17.5 to 24.2), and here the changes are 6 and 8 problems out of 200 on a single run, within noise. Thanks!

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.

2 participants