Skip to content

Multi-LoRA grouped experts: run the grouped support and parity probes only eagerly - #16415

Merged
danielhanchen merged 4 commits into
mainfrom
dh/multi-lora-cold-compile
Nov 3, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
dh/multi-lora-cold-compile

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

A first call into multi-LoRA experts can fail under torch.compile(fullgraph=True) because grouped-backend support and numerical-parity probes run during tracing. Cold compiled calls now keep the existing per-adapter path, while eager warmup still enables grouped execution before compilation.

Initial adapter selection also uses a first-match loop, preserving the previous selection semantics while avoiding torch 2.6 Dynamo's unsupported next(generator, default) call.

Validation

  • Merge-base differential: all four cold fullgraph regression cases fail on the base and pass on the head, with no skips or unchanged cases.
  • CPU: four cases pass on torch 2.6.0 and 2.15.0; current torch 2.14.1 passes both the eager compiler backend and Inductor, including output and gradient comparisons.
  • Real Zoo helpers on Kaggle Tesla T4: the base fails inside the grouped-support self-check; the head compiles with Inductor and matches forward/backward results. Eager execution still selects the real grouped path in both arms.
  • AMD gfx1151 differential: CONFIRMED on Radeon 8060S, torch 2.11.0 with ROCm 7.13. Base: four failed. Head and integration merge: four passed each.
  • Current-head switchboard: NO_REGRESSION for SFT and inference on Kaggle T4x2, and zero regressions or metric moves in regression smoke on a remote RTX PRO 6000 Blackwell. Both regression arms report 66 passed, 13 XPASS and 24 skipped.
  • Linux, macOS and Windows: four regression tests passed per OS.
  • First-adapter selection is identical across 364 adapter-group combinations. Formatting, symbol audit and pre-push checks pass.

The switchboard's only DOM-only flag is a crawler fact about a Search button; the corresponding Model Hub screenshot and normalized DOM are byte-identical. UI triage is NO and the UI gate is PROBE.

No timing improvement is claimed. GPU correctness checks used shared hardware; native WSL, Intel XPU, Ascend and multi-GPU kernel execution were not exercised. The change adds no device-specific branch or new kernel.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-11-03T04:59:08.869320Z 2e10b4d 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.

danielhanchen added a commit that referenced this pull request Nov 1, 2026
…, not at collection (#16430)

## Summary

`(Python 3.13, g-r)` fails on several unrelated PRs (#16413, #16414,
#16415):

```
test_hub_source_env_reset_between_tests.py::test_the_next_test_starts_on_the_source_it_inherited
E   AssertionError: assert 'huggingface' == None
E    +  where 'huggingface' = get('UNSLOTH_STUDIO_HUB_SOURCE')
```

The test reads `_INHERITED = os.environ.get(SOURCE_ENV)` at module
import, during collection. Collection goes on after that. Any module
collected later that imports the app (for example
`tests/test_liveness_reports_*.py` with a module-level `from main import
...`) runs `apply_hub_settings()`, and that always writes
`UNSLOTH_STUDIO_HUB_SOURCE`. The conftest fixture
`_restore_hub_settings_env` then correctly restores the value each test
started with (`huggingface`), but the test compares it against the stale
collection-time value (`None`). The fixture is right. The test's
baseline is taken too early, and whether it fails depends on which files
share the shard. #16236 made it compare against the inherited source,
which made it sensitive to this.

## Change

The first test records the source env and the "other" source at the
moment it starts. That is exactly what the fixture saves and restores.
The second test compares against those, and fails with a clear message
if it runs without the first one. Nothing else changes.

## Testing

- **Repro of the CI failure:** run this file plus a later-collected
stand-in module that sets `UNSLOTH_STUDIO_HUB_SOURCE=huggingface` at
import, the way the app import does.
  - main: fails with the same `assert 'huggingface' == None`;
  - this branch: 3 passed.
- This file alone: 2 passed. With `UNSLOTH_STUDIO_HUB_SOURCE=modelscope`
in the environment (the case #16236 was for): 2 passed.
- Sabotage: with the conftest restore loop disabled, the second test
fails again. The test still catches a missing restore.
@danielhanchen danielhanchen self-assigned this Nov 3, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 457114544d

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 2e10b4d8f9

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

@unslothai unslothai deleted a comment from danielhanchen Nov 3, 2026
@unslothai unslothai deleted a comment from danielhanchen Nov 3, 2026
@danielhanchen
danielhanchen merged commit bf38ae0 into main Nov 3, 2026
@danielhanchen
danielhanchen deleted the dh/multi-lora-cold-compile branch November 3, 2026 05:19
danielhanchen added a commit that referenced this pull request Nov 3, 2026
## Summary

`Repo tests (CPU, rest-2)` is red on main since #16415 (`bf38ae0ac6`).
On staging CI it hit #16423, #16182 and #16523 in the last hour:

```
tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding
AssertionError: 1 file reads in the test trees touch a checked-in file with the platform default encoding,
so they break on Windows as soon as that file gains a non-ASCII byte. Pass encoding = "utf-8":
['tests/test_multi_lora_cold_compile_cpu.py:33: read_text()']
```

#16415's new test parses a checked-in source file with
`path.read_text()`. On Windows that decodes with the ANSI codepage, so
it breaks as soon as the source file gains a non-ASCII byte. The guard
is right.

## Change

`tests/test_multi_lora_cold_compile_cpu.py`: `read_text()` becomes
`read_text(encoding = "utf-8")`. Nothing else changes.

## Testing

- `tests/test_source_read_encoding.py` and
`tests/test_multi_lora_cold_compile_cpu.py`:
  - main: the encoding guard fails as above;
  - this branch: 20 passed.
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