Skip to content

Studio: keep auto-load and compare panes off the default engine for compressed-tensors, AWQ and GPTQ checkpoints - #13229

Merged
danielhanchen merged 6 commits into
mainfrom
studio-offer-autoload-compare
Oct 11, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
studio-offer-autoload-compare

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Fixes #8861

#13135 made the chat model picker ask before loading a compressed-tensors (NVFP4, FP8, ...), AWQ or GPTQ checkpoint on the Default engine: the user picks vLLM or SGLang, or Cancel refuses the load. Two other chat paths call /api/inference/validate, get the same managed_engine_offer back, and ignore it:

  1. Auto-load of the last used model (sending a message with no model loaded). canAutoLoad only checks the remote-code and transformers-upgrade gates, then loads with no engine, so the Default engine. The last-model record is written after any successful load, including a vLLM load chosen in the Studio: offer vLLM or SGLang when the default engine cannot run a quantized checkpoint #13135 dialog, so the next session reloads that checkpoint on the Default engine without asking.
  2. Compare panes with the pane engine left on Default: the offer is never shown, so the load goes to the Default engine.

What the user then gets depends on their environment. Studio does not ship compressed-tensors, so on a stock install the load fails with the refusal message. If compressed-tensors was installed by hand (older builds told users to pip install compressed-tensors, which is what the #8861 reporter did), transformers decompresses the checkpoint and generates very slowly. That is the behaviour #8861 reports, and it happens again even after the user chose vLLM once.

Changes

  • chat-adapter.ts canAutoLoad: a candidate with a managed_engine_offer is skipped, the same way as the existing transformers-upgrade gate (a background load never makes that choice). It counts against the validate budget like the other refusals, so the cascade moves on to the next cached model.
  • shared-composer.tsx: a compare pane on the Default engine now gets the same offer as the primary picker: the managed engine dialog (Load with vLLM / SGLang, or Install and load). After a pick the pane re-validates as that engine, keeping its saved GPU pick, and loads with it. Cancel refuses with the picker's message ("... is quantized with compressed-tensors, which the default engine cannot run. Set Inference engine to vLLM in its run settings to load it."). A pane already set to vLLM or SGLang is unchanged.

The offer is only returned where the backend's support_reason says vLLM or SGLang can run on this machine. On Mac, CPU-only, AMD, older NVIDIA, and when the probe fails, nothing changes.

Testing

  • New tests/managed-engine-offer-background-loads.test.ts runs both decisions taken from the shipped source: auto-load skips an offered checkpoint; a compare pane asks once, loads with the pick (re-validated, saved GPUs kept), refuses on Cancel, and never asks for panes already on vLLM / SGLang or for ordinary checkpoints. Reverting either hunk fails its tests.
  • tests/auto-load-validate-budget.test.ts: the dead-end count goes from 3 to 4 (three refusals and one rejection).
  • Full frontend suite: 11245 passed, 0 failed. npm run typecheck is clean.
  • The backend offer was checked against the real unsloth/Qwen3.8-27B-NVFP4 config.json, with the host probes stubbed. Windows 10 22H2 x64 with an RTX 5090 and driver 581 gets {'quantization': 'compressed-tensors', 'engines': ['vllm', 'sglang']}. Windows 10 2004, a driver below 580, and a T4 get no offer.

Before / after

Compare mode, both panes on unsloth/Qwen3.8-27B-NVFP4, Default engine, on a Linux host that can run vLLM (stock Studio install, no compressed-tensors). Before: the pane calls /api/inference/load and the backend refuses it. After: the pane opens the same vLLM / SGLang offer as the primary picker, with no /load call until a choice is made.

Compare pane before and after

@danielhanchen danielhanchen self-assigned this Oct 10, 2026
@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-11T08:13:03.332279Z 7b1d482 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.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 10, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: cb72d5d1e5

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

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd8bd3a99c

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

Comment on lines +1842 to +1847
paneEngineFields = {
engine,
engine_precision: "auto",
engine_parallelism: "tensor",
load_in_4bit: false,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve configured GPUs after accepting the engine offer

When a pane has remembered selectedGpuIds but its engine is currently Default—possible after switching a previously configured vLLM/SGLang model back to Default—accepting this offer replaces paneEngineFields without restoring gpu_ids. Both the second validation and /load then use the managed engine's default GPU instead of the pane's saved selection, potentially loading on the wrong device or failing for lack of memory. Preserve the reconciled pane GPU IDs here, as the primary managed-engine offer path does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c5d8b36: the switched fields carry the pane's reconciled GPU pick, as the primary path does; covered by a test.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 11, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: c5d8b365c3

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

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 7b1d482438

ℹ️ 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 86c5ac2 into main Oct 11, 2026
@danielhanchen
danielhanchen deleted the studio-offer-autoload-compare branch October 11, 2026 09:25
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 26, 2026
…load (unslothai#15139)

The model picker, the compare pane and auto-load each built two payloads
from the same settings: one for the `/validate` preflight and one for
`/load`. `validateModel` then re-serialized the first through a
hand-kept allow-list. That is 13 payload literals across
`use-chat-model-runtime.ts`, `shared-composer.tsx`, `chat-adapter.ts`
and `chat-api.ts`, and every new load setting had to be added to each
one.

The history shows the copies drifting apart:
- unslothai#9410 added Checkpoints and the draft KV dtype to every load and never
to the allow-list.
- unslothai#13596 (vLLM/SGLang KV dtype, seed, memory limit) had to edit the
picker, compare and `chat-api.ts` separately.
- The managed-engine offer (unslothai#13135, then unslothai#13229) and GGUF settings
preservation (unslothai#9562, then unslothai#11311) each landed on the picker first and
needed a follow-up PR for compare and auto-load.

The preflight exists so Studio refuses a load before it unloads the
working model, and also to guard training. When `/validate` judges a
different command from the one `/load` runs, it approves a load that
`/load` then refuses after the unload, or refuses one that would fit.

## Changes

- **One request, sent twice.** Each path builds one `LoadModelRequest`
and sends it to both `/validate` and `/load`. Only the load-only fields
are added at the `/load` call: request id, lease, force flags and
`alongside`.
- **The allow-list is gone.** `/validate`'s body is the load request;
the route ignores load-only fields. `validateRequestBody` fills defaults
for the non-nullable fields only.
- **`llamaServerLoadFields`** owns the one rule for llama-server's
knobs, which the three paths used to spell out with slightly different
gating:
- reasoning budget, batch sizes, server tuning and pass-through args are
sent for GGUF only;
- diffusion GGUF requests omit custom reasoning overrides, server tuning
and pass-through args, while still forwarding batch sizes;
  - blank values are omitted, never sent as null.
- **The picker re-baselines once.** On a model switch it re-baselines
its per-model settings before `/validate`, instead of mirroring that
reset in a second set of `validate*` variables.
- **New module.** `lib/load-request.ts` holds the three helpers.
Production code is 225 lines shorter.

## Preflight and load now agree

- **The three dropped settings now reach `/validate`.** `validateModel`
dropped `ctx_checkpoints`, `spec_draft_cache_type` and `tensor_split`.
Checkpoints affect sizing; a load with Checkpoints set was priced at the
default 32. Forwarding the draft KV dtype and GPU split makes validation
apply the same explicit-setting precedence over inherited flags as
loading. The training coexistence guard does not directly price draft KV
memory.
- **The picker and compare preflights now send the speculative mode and
depth.** They omitted `speculative_type` and `spec_draft_n_max`, so
validation used the default Auto mode, which already counts some
drafters but can differ from the selected mode. The preflight now
receives the same selected values as loading. Auto-load already sent
them.
- **A model switch with a staged run-settings config is now sized like
the load.** The picker's preflight used Auto layers and no context pin,
while `/load` used the staged layer count and context length.
- **Compare and auto-load no longer send llama-server's pass-through
args or tuning to a diffusion GGUF.** The diffusion runner takes none of
them, and the picker already left them out.

## Validation

- **Wire check:** the same GGUF request was sent through the real
`chat-api.ts` of each checkout, comparing what `/validate` receives with
what `/load` receives. On `main`, `/validate` is missing `tensor_split`,
`spec_draft_cache_type` and `ctx_checkpoints`; here it is missing
nothing.
- **Contract test:** `chat-load-request-one-builder.test.ts` reads
`ValidateModelRequest` from `studio/backend/models/inference.py`. It
fails if any field it prices cannot ride `LoadModelRequest` or is not
forwarded. It also table-tests the llama-server knob rule and checks
that every path sends one request.
- **Frontend:** `npm test` gives 13,857 passed. The 3 failures are
HTML/TextEdit charset decoding tests that fail the same way on `main` in
this environment. Typecheck is clean with both `bun check` and `tsc`.
- **Python contract tests:** the 30 files in `tests/studio` that read
these sources give 807 passed and 63 skipped. The two Playwright files
cannot import here, on `main` too.
- **The auto-load harness** (`test_chat_autoload_failure_gate.py`) now
inlines the real `load-request.ts` instead of a copy; all 81 scenarios
pass.
- **Rewritten tests:** text-matching tests that counted the duplicated
literals now assert one request per path. The rule they pinned is tested
behaviourally in the new file.

| Case | Before | After |
|---|---|---|
| GGUF load with Checkpoints, draft KV dtype or a per-GPU split |
`/validate` sent none of the three; used default checkpoints and could
resolve inherited flags differently | Same fields as `/load` |
| Picker or compare load with a DFlash/DSpark drafter | Preflight sized
Auto rather than the selected speculative mode | Selected mode
forwarded, as in `/load` |
| Model switch from a staged config with a context length and manual
layers | Preflight sized Auto context and Auto layers | Sized like
`/load` |
| Compare or auto-load of a diffusion GGUF with remembered extra args |
Args and tuning sent to a runner that takes none | Not sent, as the
picker already did |

Not in this PR: auto-load still ignores a model's saved engine
(vLLM/SGLang) and loads it on the default engine. That looks deliberate
(background loads avoid starting a managed engine), so it is left as is.

---------

Co-authored-by: Daniel Han <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Studio Bug] Qwen3.8-27B-NVFP4 extremely slow inference on RTX 5090 / Windows

1 participant