Skip to content

Tests: follow TRL's renamed tiny Phi-3 and Qwen3.5 repos - #15355

Merged
danielhanchen merged 1 commit into
mainfrom
ci-trl-tiny-renamed
Oct 26, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-trl-tiny-renamed

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

trl-internal-testing/tiny-Phi3ForCausalLM and trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration no longer exist on the Hub. The model API returns 404 for both, even with a token. TRL now publishes versioned names instead:

  • tiny-Phi3ForCausalLM-3 and -3.5
  • tiny-Qwen3_5ForConditionalGeneration-3.8, -NoThink and -Think

Every test that loads one of the old ids fails with OSError: ... is not a valid model identifier. This is red on every PR based on current main, in both Repo tests (CPU, rest) and Repo tests (CPU, gloo) (#15337, #15342):

  • the phi3 cases of test_tp_native_oracle.py and test_tp_native_gloo.py
  • the Qwen3.5 cases of test_decision_model.py and test_decision_from_lm.py

Nothing in the repo changed; the upstream repos were renamed.

Fix

Point the seven references at the closest renamed repo. I picked each one by diffing its config against the old repo's config, which was still in a local Hub cache:

old new config differences
tiny-Phi3ForCausalLM tiny-Phi3ForCausalLM-3 vocab_size 32011 to 32064, sliding_window None to 2047, attention_bias None to False
tiny-Qwen3_5ForConditionalGeneration tiny-Qwen3_5ForConditionalGeneration-NoThink text_config.full_attention_interval 4 to 2; byte-identical chat_template.jinja

I rejected the other candidates:

  • tiny-Phi3ForCausalLM-3.5 adds longrope scaling and a 131k context.
  • tiny-Qwen3_5ForConditionalGeneration-3.8 changes the MLP size, the value heads and the embedding tying, and ships a different chat template.

tiny-Qwen3_5ForConditionalGeneration-NoThink was already used by one test.

No other trl-internal-testing/* id referenced under tests/, studio/, unsloth/, scripts/ or .github/ is missing from the org's current model list.

Verification

Every test id that failed in CI on #15337 and #15342 for this reason now passes against the downloaded new repos:

  • test_tp_native_oracle.py: phi3 plan, simulated TP, fused-qkv GQA layout and per-module local heads
  • test_tp_native_gloo.py: test_tp2_matches_one_process[phi3], test_sharded_loading_matches_full_load[phi3-2-None], test_tp2_x_fsdp2_dp2_matches_one_process[phi3-True-None] and test_tp2_phi3_fused_qkv_under_a_packed_plan_matches_one_process
  • test_decision_model.py: the clef encoding, collator and temperature-folding cases
  • test_decision_from_lm.py: the train, save and reload case, and test_the_decision_notebook_runs_unchanged_on_a_plain_qwen3_5

That is 45 + 1 passed. The wider selection over the seven touched files passes as well: 187 passed, 12 skipped.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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-26T10:56:57.994168Z 29da5ed 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. Nice work!

Reviewed commit: 29da5ed7ea

ℹ️ 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".

@danielhanchen
danielhanchen merged commit e3a276a into main Oct 26, 2026
0 of 15 checks passed
@danielhanchen
danielhanchen deleted the ci-trl-tiny-renamed branch October 26, 2026 11:02
danielhanchen added a commit to unslothai/unsloth-zoo that referenced this pull request Oct 26, 2026
…2108)

## Problem

`trl-internal-testing/tiny-Qwen3_5ForConditionalGeneration` is gone from
the Hub. The model API returns 404, even with a token. TRL now publishes
versioned names: `-3.8`, `-NoThink` and `-Think`.

`tests/test_speculative_capture.py` loads it as `QWEN35_VLM`, and its
loader turns any load error into `pytest.skip("... unavailable
offline")`. So in CI the Qwen3.5 VLM cases have been skipping silently
instead of running.

## Fix

Use `tiny-Qwen3_5ForConditionalGeneration-NoThink`. Its config differs
from the old repo's only in `text_config.full_attention_interval` (4 to
2), and its `chat_template.jinja` is byte-identical. I compared it
against the old repo's config, which was still in a local Hub cache. The
same rename is in unslothai/unsloth#15355. No other
`trl-internal-testing/*` id referenced in this repo is missing from the
org's current model list.

## Verification

`tests/test_speculative_capture.py`: 6 passed and 1 skipped. The VLM
cases now load the model and run. The one skip is the locally built
Qwen3.5 text fixture, which is unrelated to this change.
danielhanchen added a commit that referenced this pull request Oct 26, 2026
…ative Trainer runs back on the default (#15397)

## Problem

#15381 set `adam_epsilon = 1e-4` in the shared `_trainer_args` of
`tests/test_tp_native_gloo.py`. That fixed the three UNSLOTH_TP_SIZE
Trainer tests in `test_tp_env_gloo.py`, but on the CI runners it broke
the two native Trainer tests that use the same helper. Comparing the
`gloo` shard before and after (both on current-main bases):

| CI run | native
`test_trainer_trains_a_tensor_parallel_model_like_one_process[1-2]` /
`[2-2]` | `test_env_tp2_*` (3 tests) |
|---|---|---|
| #15284, base 975e864 (before #15381) | pass | fail |
| #15386, base 0be4c5d (after #15381) | fail on `lora_A` state (`rtol =
1e-4, atol = 1e-6`) | pass |

On this host both groups pass at both settings. The runners' CPUs round
differently from this machine, and I could not emulate theirs here:
`ATEN_CPU_CAPABILITY=avx2` aborts the spawned ranks with `buffer
overflow detected`. So the CI table above is the evidence for which eps
each group needs.

The two groups differ in their adapters. The env tests use
`init_lora_weights = False`, where every factor gets a real gradient
from step 1; that is where the default eps amplifies reduction-order
noise, as measured in #15381. The native tests use the default `B = 0`
start, where `lora_A`'s gradients are tiny for the first steps. There,
eps 1e-4 sits inside their range and moves `lora_A` differently on the
two arms.

## Fix

- `_trainer_args` goes back to AdamW's default eps, so the native
Trainer tests run as they did when they passed on CI.
- `test_tp_env_gloo.py` passes `adam_epsilon = 1e-4` only at its own
training call, with the measurement and the reason in a comment.

Tolerances are unchanged.

## Verification

- `tests/test_tp_env_gloo.py` and `tests/test_tp_native_gloo.py`: 52
passed on this host.
- This PR's own `Repo tests (CPU, gloo)` shard is the check on runner
hardware. Both groups should pass there.

## Not covered here

`test_tp2_x_fsdp2_dp2_matches_one_process[phi3-True-None]` also fails in
both CI runs above, by 6.9e-5 to 7.7e-5 relative on grad norms
(tolerance 1e-5), and passes on this host. It only became visible after
#15355: before that, the `phi3` cases errored on the removed tiny model.
It uses its own hand-written loop (eps 1e-6), not `_trainer_args`, so
this change does not touch it.
danielhanchen added a commit that referenced this pull request Oct 26, 2026
… shards (#15400)

## Problem


`tests/test_tp_native_gloo.py::test_tp2_x_fsdp2_dp2_matches_one_process[phi3-True-None]`
fails in `Repo tests (CPU, gloo)` on every recent run, on the per-step
grad norms (tolerance 1e-5):

| CI run | step 1 | step 2 | step 3 |
|---|---|---|---|
| #15284 (job 121590971980) | 1.5e-6 | 3.6e-5 | 7.7e-5 |
| #15386 (job 121637289351) | 1.5e-6 | 3.6e-5 | 6.9e-5 |

It only became visible after #15355. Before that, every `phi3` case
errored on the removed `trl-internal-testing/tiny-Phi3ForCausalLM`. On
this host the same test passes inside 1e-5.

## Product or test

The test. In the same run, the loss check (rel 1e-5) and the step-1
per-gradient check (`rtol = 1e-4, atol = 1e-6` on every LoRA gradient)
both pass. Only the multi-step norms drift, and the gap grows each step
from a 1.5e-6 start. That is reduction-order noise compounded by AdamW,
which phi3's fused qkv and gate_up shards make larger than llama's. The
runners' CPUs round differently from this host.

A real tensor-parallel error does not hide behind the norms. With the
backward all-reduce of the column-parallel input removed in
`tp_native.py` (`return grad, None`), the phi3 case fails on the step-1
per-gradient check, before the norms are compared.

## Fix

`_TP_FSDP2_NORM_REL = {"phi3": 2e-4}` sets the norm tolerance for phi3
only, with the CI measurements in a comment. Every other arch keeps
1e-5. The loss, per-gradient, mismatch and placement checks are
unchanged for all arches.

## Verification

- `test_tp2_x_fsdp2_dp2_matches_one_process`: all 5 parametrizations
pass.
- Sabotage: with the all-reduce removed, the phi3 case still fails.
- ruff format and check are clean.
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