Skip to content

version_compat tests: follow TRL 1.15's chunked_nll alias and GPU-only DPO scorer - #13207

Merged
danielhanchen merged 1 commit into
mainfrom
ci-trl115-cpu-tests
Oct 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-trl115-cpu-tests

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

The GRPO fake-run (CPU spoof, TRL latest) lane is red on every PR, because "TRL latest" is now TRL 1.15.0. Reproduced on main (a2915de) with TRL 1.15.0, transformers 5.18 and unsloth-zoo main. Three of the failures come from the tests, not from Unsloth:

FAILED tests/version_compat/test_trl_loss_normalization_contract.py::test_explicit_loss_type_still_wins
  AssertionError: explicit loss_type was clobbered  'nll' == 'chunked_nll'
FAILED tests/version_compat/test_trl_loss_normalization_contract.py::test_pristine_trl_sft_config_keeps_an_explicit_loss_type
FAILED tests/version_compat/test_trl_fake_train_cpu.py::test_dpo_trains_on_cpu
  AssertionError: libcuda.so cannot found!   (trl/kernels/chunked_logprob.py, Triton)
  • TRL 1.15 deprecated loss_type="chunked_nll" as an alias of "nll". Its own SFTConfig.__post_init__ rewrites the value and raises a FutureWarning. Plain TRL does the same with Unsloth not imported, so this is not Unsloth overriding the user's choice.
  • TRL 1.15's DPOTrainer always calls the model with fused_lm_head=True. That routes log-probs through trl/kernels/chunked_logprob.py, a Triton kernel with no CPU fallback, so plain TRL cannot train DPO on a CPU either.

The ORPO/CPO row-cap failures in the same lane are a real Unsloth gap. #13203 fixes them, so they are not touched here.

Fix

  • test_trl_loss_normalization_contract.py: _trl_resolves(wanted) asks TRL's own SFTConfig what it does with the value, treating it as an alias only when TRL raises its deprecation FutureWarning for it. Both tests now also check "dft", which TRL never aliases, so a real Unsloth rewrite still fails them.
  • test_trl_fake_train_cpu.py: skip test_dpo_trains_on_cpu only when the installed trl.trainer.dpo_trainer uses fused_lm_head=True. TRL 1.14 and older still have to train DPO on a CPU.

Verification

TRL Before After
1.15.0 3 failed 16 passed, DPO CPU skipped (Triton-only)
1.14.1 passed 18 passed, DPO CPU still runs

Sabotage check: a plugin that forces loss_type = "nll" after TRL's __post_init__ makes both loss_type tests fail on TRL 1.14.1 and 1.15.0.

…DPO scorer

TRL 1.15 deprecated loss_type="chunked_nll" as an alias of "nll" and rewrites it in SFTConfig.__post_init__, so the explicit-loss_type tests read TRL's own rewrite as Unsloth clobbering the user's choice. Compare against what TRL itself makes of the value (read from its deprecation FutureWarning), and also check "dft", which no TRL aliases.

TRL 1.15 also scores DPO through its fused LM head, a Triton kernel with no CPU path, so plain TRL cannot train DPO on a CPU. Skip test_dpo_trains_on_cpu only when the installed TRL's dpo_trainer calls the model with fused_lm_head=True.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T05:50:28.087968Z 280724f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 280724fb37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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