Skip to content

Run the trainer, apply_chat_template and fused LM head tests on the tiny Qwen4 MoE model - #8775

Open
albertvillanova wants to merge 1 commit into
qwen4-tinyfrom
qwen4-tests
Open

albertvillanova wants to merge 1 commit into
qwen4-tinyfrom
qwen4-tests

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

This PR runs the SFT, DPO, KTO, GRPO, RLOO and distillation trainer tests, apply_chat_template and the fused LM head tests on trl-internal-testing/tiny-Qwen4MoeForConditionalGeneration.

Changes

  • Add a qwen4-moe case, skipped before transformers 5.26.0, to the text and VLM trainer tests, apply_chat_template and the fused LM head VLM tests.
  • The QSA indexer only picks which tokens attention reads, so the loss sends it no gradient: the "params changed" checks assert it stays frozen, as for Qwen4-Exp.
  • The Flash Attention VLM case is a strict xfail until Qwen4-Exp: support Flash Attention transformers#51369, as for Qwen4-Exp.

All qwen4-moe cases pass on an H100 with transformers 5.26.0: 30 passed, 1 xfailed (the Flash Attention case).


Note

Low Risk
Test-only parametrization and assertion updates; no production trainer or library code changes.

Overview
Adds Qwen4 MoE (tiny-Qwen4MoeForConditionalGeneration) to the existing cross-trainer and utility test matrices, gated on transformers ≥ 5.26.0.

New qwen4-moe parametrizations appear in SFT, DPO, KTO, GRPO, RLOO, and distillation trainer tests (text and VLM paths), apply_chat_template tokenizer coverage in test_data_utils.py, and fused LM head / forward checks in test_utils.py. Post-training parameter-update assertions now treat Qwen4 MoE like Qwen4-Exp: .indexer. weights must stay frozen because the QSA indexer receives no gradient. The SFT Flash Attention VLM case for Qwen4 MoE is marked strict xfail until transformers supports it (same as Qwen4-Exp).

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

@bot-ci-comment

bot-ci-comment Bot commented Dec 4, 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.

This branch has not been deployed

No deployments
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.

1 participant