Skip to content

Studio: offer vLLM or SGLang when the default engine cannot run a quantized checkpoint - #13135

Merged
danielhanchen merged 11 commits into
mainfrom
studio-vllm-engine-offer
Oct 9, 2026
Merged

danielhanchen merged 11 commits into
mainfrom
studio-vllm-engine-offer

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #13043 for #11728.

#13043 made the hub and the load error point at the optional engines. This makes the load itself do it: picking a compressed-tensors (NVFP4, FP8, W4A16, ...), AWQ or GPTQ checkpoint in chat with the Default engine now opens a dialog instead of starting a load that is guaranteed to fail.

  • If vLLM or SGLang is already installed and up to date, the dialog offers "Load with vLLM" / "Load with SGLang" and reuses it. Nothing is reinstalled.
  • Otherwise it shows the existing engine install prompt for each engine (download size, the WSL2 / UAC notice on Windows, owner only), and "Install and load" continues the same load on that engine once the install finishes.
  • Cancel ends the load with "... is quantized with compressed-tensors, which the default engine cannot run. Set Inference engine to vLLM in its run settings to load it." The previous model is never unloaded, because the dialog opens from the pre-load validation step, before anything is replaced.
  • After a choice the load is validated again as that engine before anything is unloaded, and with Keep loaded models on it asks about running chats and replaces, exactly like a load where vLLM or SGLang was picked in run settings.

The dialog only appears where the backend's own support_reason(engine) says the engine can run: Linux x86_64 or Windows x64 (through Studio's private WSL2 distro), NVIDIA compute capability 8.0+ and a new enough driver. Mac, AMD, CPU-only, Windows ARM and older NVIDIA see exactly what they saw before.

Changes

Backend

  • /api/inference/validate returns managed_engine_offer: {quantization, engines} for a Default-engine, non-GGUF, non-adapter, non-audio request whose checkpoint config.json (or text_config) says compressed-tensors, or awq / gptq while no AWQ / GPTQ package is importable (Studio ships none). engines lists only the engines this host can run, vLLM first. SGLang is listed for compressed-tensors only on SM 10.0+ GPUs: its NVFP4 scheme needs Blackwell (get_min_capability 100 in 0.5.20), while vLLM's falls back to Marlin from SM 7.5.
  • Read-only and cheap: config.json comes from the Hub cache that resolving the model already filled (0.08 ms per pick instead of a 45 ms Hub round trip), in a worker thread inside the existing offline guard. The GPU check only runs for these checkpoints, and any failure returns no offer, so validation never fails because of it.

Frontend

  • ManagedEngineOfferDialog (root mounted, like the transformers upgrade dialog) and a small store: one open offer at a time, a newer load declines the older one, and cancelling the load closes the dialog.
  • selectModel waits on the dialog right after validation, validates again as the chosen engine, then sends the same /load with it (precision and parallelism reset to model default, no 4-bit conversion). The loaded engine then shows in the run settings as usual.
  • EngineInstall is exported and reused unchanged, so install progress, cancel, errors and the Windows restart state behave exactly as in Settings and run settings. An install started from the dialog stays mounted until it hands the load over.

Not changed: the compare pane, the startup auto-load and API callers still get the #13043 refusal and hint; no per-model setting is written (a second load of the same model is one click because the engine is reused).

Testing

  • On a B200 through Studio's managed engines, SGLang 0.5.20 and vLLM 0.30.0 both load unsloth/Qwen3.8-27B-NVFP4 and answer correctly.
  • Isolated Studio on a B200, chat picker, unsloth/Qwen3.8-27B-NVFP4 on Default, at this branch:
    • neither engine installed: the dialog lists vLLM and SGLang; Install engine > Install and load installs vLLM (0.9 GiB), the load resumes by itself, the status reports engine vllm, and chat answers "391" to "What is 17 * 23?".
    • vLLM installed: "Load with vLLM", one click, loaded and answered "Canberra".
    • SGLang installed: "Load with SGLang".
    • Cancel: refusal toast, nothing loaded or unloaded.
  • On main (1c946d1) the same pick runs a Default load that fails with the compressed-tensors refusal.
  • /api/inference/validate on this branch: NVFP4 and Qwen/Qwen2.5-7B-Instruct-AWQ get {engines: [vllm, sglang]}, plain unsloth/Qwen3.8-27B gets none; on main none of them has the field. A cold GPU probe is resolved inside validate rather than reported as unsupported.
  • The offer predicate enumerated over 3,072 input combinations (quant method x nesting x engine x GGUF x adapter x host support x AWQ / GPTQ packages): 3,012 return no offer exactly as on main, 60 offer, 0 violations.
  • studio/backend/tests/test_managed_engine_offer.py (30 cases), test_compressed_tensors_load_error_message.py still passes. studio/frontend/tests/managed-engine-offer.test.ts: choose, decline, supersede, abort, ordering before the preliminary unload, Keep loaded models, install hand-over. Full npm test (11,127), tsc -b and vite build pass; eslint reports no new problems.
  • Studio regression switchboard (auth, settings, model picker, upstream CI, inference settings, parallel chats, image generation, crawl) vs the merge base: no functional regression.
  • Staging CI: cross-platform (Linux, macOS, Windows) and the Studio Playwright leg are green.
  • Declining the running-chats prompt after picking an engine with Keep loaded models on now exits as a plain cancel (no error toast), the loading toast no longer says the other models are kept, and the dialog shows an error instead of spinning if it cannot read the installed engines. Frontend suite: 11,127 tests pass.

Picking the NVFP4 checkpoint in chat, before and after:

Picking the NVFP4 checkpoint, before and after

Install and load from the dialog, then chat on vLLM:

Install and load

With vLLM already installed it is one click; Cancel leaves everything as it was:

Reuse and cancel

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 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-09T15:53:58.474902Z 1c553b0 Manual request
🔒 Security Review ⚠️ Failed 2026-10-09T13:03:36.767626Z 50c7014 PR opened
ℹ️ 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 Summary

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

Review Status Commit Review trigger
🔒 Security Review 🔄 Running since 2026-10-09T13:03:33.765432Z 50c7014 PR opened
ℹ️ 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

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: 7434ead5da

ℹ️ 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 +16818 to +16820
method = method.strip().lower()
if method not in _MANAGED_ENGINE_QUANTIZATIONS:
return None

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 Normalize compressed-tensors quantization aliases

Checkpoints using the established compressed_tensors spelling never receive an offer because the method is only lowercased and then compared with the hyphenated key. The repository's existing quantization loader explicitly treats compressed-tensors, compressed_tensors, and sparseml as the same compressed-tensors family, so these legacy checkpoints still enter the Default-engine failure path instead of the new dialog. Normalize underscores to hyphens and map the supported legacy alias before this lookup.

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.

Not changing: checkpoints spelled compressed_tensors keep exactly the behaviour they have on main (the existing refusal); the offer covers the spelling transformers and llm-compressor write today.

engine_precision: "auto",
engine_parallelism: "tensor",
};
engineSwitched = true;

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 Skip the Default-engine upgrade gate after switching engines

After this branch switches the request to vLLM or SGLang, execution continues using the Default-engine validation result, including requires_transformers_upgrade. A newly supported architecture can therefore prompt for—and require—the Studio Transformers overlay even though the selected managed engine runs in its own environment and will not use that overlay; declining the irrelevant upgrade aborts the managed load. Once engineSwitched is set, suppress the Default-engine upgrade gate or derive the requirement from a managed-engine validation.

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.

Not changing here: the gates now run on the chosen engine's own /validate answer, the same one a load gets when vLLM or SGLang is picked in run settings. Whether managed loads should skip the transformers upgrade gate is a separate question for that existing path.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 9, 2026

@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: 757aacdbcf

ℹ️ 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 thread studio/backend/routes/inference.py Outdated
Comment on lines +16856 to +16859
if name != "sglang" or method != "compressed-tensors":
return True
# SGLang 0.5.20's compressed-tensors NVFP4 needs SM 10.0 (get_min_capability 100, no
# Marlin fallback; vLLM's starts at 7.5), so it is offered for these on Blackwell only.

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 Apply the Blackwell gate only to NVFP4 checkpoints

When a compressed-tensors checkpoint uses another format such as FP8 or W4A16 on an Ampere/Hopper host, method is still compressed-tensors, so this branch applies the SM 10.0 restriction and incorrectly removes SGLang from the offer. The restriction described here is specific to the NVFP4 scheme; inspect quantization_config.format before applying it so other compressed-tensors formats can still offer SGLang.

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.

Not changing: SGLang is left out for every compressed-tensors format below SM 10.0 on purpose, since vLLM covers those formats on Ampere and Hopper and stays offered. Nothing that worked before is refused.

Comment on lines +16861 to +16863
return any(
float(row[1]) >= 10.0 for row in _driver_rows(None) or () if len(row) == 2
)

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 Check the GPUs selected for the SGLang load

On a mixed-generation host, a single B200 makes this return true even when the request selects only H100/A100 GPUs (or the B200 is outside Studio's visible set). The follow-up managed validation only applies the engine's general SM 8.0 support check and does not repeat this NVFP4-specific SM 10.0 requirement, so choosing SGLang can pass preflight, unload the resident model, and then fail during engine startup. Evaluate the resolved requested GPU IDs and require every GPU used by the load to meet the scheme requirement.

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.

Not changing: a host mixing Blackwell with older GPUs and picking only the older ones for an NVFP4 SGLang load is outside what this dialog targets; that load fails with SGLang's own error and nothing silent happens.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 9, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 9, 2026

@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: 305e575be5

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

if (!nativePathToken) {
Object.assign(
validation,
await validateModel({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Revalidate the chat-template override before unloading

When the checkpoint has a saved chatTemplateOverride, this managed-engine revalidation drops it; validateModel also does not serialize it and ValidateModelRequest does not declare it. The subsequent /load does send chat_template_override, but core/inference/managed_engine.py::validate_load rejects every override for vLLM/SGLang. Consequently the preflight passes, the current resident is unloaded, and /load then returns 400 and forces a disruptive rollback. Propagate the effective override through the validation API so this incompatibility is rejected before unloading.

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.

Not changing: /validate has never carried chat_template_override, so a load that picks vLLM or SGLang in run settings with a saved override takes the same path today. Here it also needs an override saved for a checkpoint the Default engine has never run.

@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: 305e575be5

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

);
if (abortCtrl.signal.aborted) throw new Error("Cancelled");
if (!stopDecision.proceed) throw new Error("Model load cancelled.");
keepsOthers = 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 Restore every kept model after a failed engine switch

When Keep loaded models is enabled with multiple resident slots, setting keepsOthers to false makes this a replacing load, and the backend's _retire_kept_models unloads every extra slot before managed-engine startup. If startup then fails, the rollback at use-chat-model-runtime.ts:3094 reloads only previousCheckpoint, leaving all other previously kept models unloaded. Fresh evidence in this revision is that the new rollback bookkeeping restores the primary model but neither snapshots nor reloads the entries in loadedNow; preserve or restore those extra slots as part of the failed switch.

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.

Not changing: this is the rollback every replacing load already has (kept extra slots are retired, the primary is restored on failure), including a vLLM or SGLang load chosen in run settings.

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

Copy link
Copy Markdown

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

Reviewed commit: e434369ed1

ℹ️ 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. Keep them coming!

Reviewed commit: 114a2c4a03

ℹ️ 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 9, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 9, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 9, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…pt-models note, show engine check errors in the offer dialog
@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: 4d669a1b43

ℹ️ 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 +2418 to +2420
if (!engine) {
throw new Error(
`${displayName} is quantized with ${engineOffer.quantization}, which the default engine cannot run. Set Inference engine to ${engineOffer.engines[0] === "sglang" ? "SGLang" : "vLLM"} in its run settings to load it.`,

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 Treat cancelling the engine offer as cancellation

When the user clicks the dialog's Cancel button, confirmManagedEngineIfNeeded resolves to null without aborting the load, so this branch throws a normal failure. The surrounding handlers then replace the loading toast with an error and populate modelsError/lastModelLoadError, even though no load or unload was attempted. Route this through the same user-cancellation path used when the subsequent replacement prompt is declined.

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.

Keeping this one as is on purpose. Cancel here means the user chose not to use vLLM / SGLang, and the toast is the only place they learn why the pick did not load and what to set instead (Inference engine in run settings). It matches what main does for the same pick, where the Default load fails with that refusal, and nothing was unloaded. The replacement prompt is different: there the user already chose the engine and only declined replacing the loaded models, which is a pure cancel.

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

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 1c553b0f1e

ℹ️ 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 bb478c6 into main Oct 9, 2026
@danielhanchen
danielhanchen deleted the studio-vllm-engine-offer branch October 9, 2026 16:21
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant