Studio: improve AMD NPU discovery, CLI support, and chat feedback by oobabooga · Pull Request #13797 · unslothai/unsloth · GitHub
Skip to content

Studio: improve AMD NPU discovery, CLI support, and chat feedback - #13797

Merged
oobabooga merged 28 commits into
unslothai:mainfrom
oobabooga:studio-npu-ux
Oct 16, 2026
Merged

oobabooga merged 28 commits into
unslothai:mainfrom
oobabooga:studio-npu-ux

Conversation

@oobabooga

@oobabooga oobabooga commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Chat on the AMD Ryzen AI NPU works once a user finds it. On a Strix Halo machine, though, the NPU section in the model picker would not open from its heading, the CLI could not use NPU models, and one common failure showed a blank reply. This fixes those gaps.

Changes

Chat

  • When a reply's reasoning fills the NPU context, the chat now says "Response filled the model's context window. Start a new chat, or shorten this one, to keep going." Before, it showed only "Worked for 2m 37s", because FastFlowLM ends that stream with stop instead of length. API clients now get length too.
  • Collapsible sections in the model picker now open from their label, not only from the 12 px chevron at the far edge. This applies to every collapsible section, including the NPU one that holds Enable NPU. The NPU setup text is also plainer.

CLI

  • unsloth run --model qwen3-0.6b-FLM (or lemonade:<id>) enables the NPU runtime, downloads the model, and serves it. Before, the id was parsed as a GGUF repo. For NPU models, the banner shows only the chat example.
  • unsloth chat qwen3-0.6b-FLM chats through a running Studio. Without one, it says how to start it instead of crashing.
  • unsloth start explains that coding agents need a GGUF model instead of looking the id up on Hugging Face.

API

  • With "Switch model by request" on, naming a downloaded NPU model loads it under the same safeguards as a GGUF switch; a cancelled request does not switch. Requests the NPU model could not serve are refused before anything is unloaded: Anthropic Messages, streaming Responses, audio or video input, and images, including tool-result images, for a model without vision.
  • Loading an NPU model while another model is serving now waits for active inference first, as GGUF and transformers loads do.
  • /v1/messages with an NPU model loaded explains that NPU models serve /v1/chat/completions only. Before, it said "No GGUF model loaded".
  • Tool-call replies no longer carry "\n\n\n" as content.

Limits

  • Coding agents, Anthropic Messages, completions and embeddings still need a GGUF model.
  • A reasoning-only reply that does not fill the context still saves without a notice. That rule is shared by every provider.

Screenshots

Model picker after clicking the "NPU" heading (two isolated installs, NPU responses mocked):

studio-npu-ux-pr-picker

A reply whose reasoning fills a 2048-token context, on the Strix Halo machine:

studio-npu-ux-pr-context-full

Verification

On AMD Ryzen AI MAX+ 395 machines, main (A) and this branch (B) were installed from source on Linux and on Windows, and both ran the same steps:

Check A (main) B
Click the "NPU" heading in the picker stays folded opens, Enable NPU shown
Reasoning fills a 2048 context no text, no notice context-window notice
/v1/messages with NPU loaded 503 "No GGUF model loaded" 400 naming the NPU model
Request naming the NPU model, switching on 404 loads and answers
unsloth run --model qwen3-0.6b-FLM fails serves, chat-only banner
unsloth chat qwen3-0.6b-FLM traceback answers

On B, with switching on, requests the NPU model cannot serve were refused without unloading anything (Linux and Windows). On Linux, with a GGUF reply streaming on the iGPU, a request naming the NPU model waited for the reply to finish before loading.

New backend and CLI tests fail without these fixes. The related backend, CLI and frontend suites show no new failures, and the type check is clean.

Before / after (merge base 5e927b0 vs head f39640f)

Two isolated Studio installs, one per commit. The NPU API is mocked in the browser, as in the screenshots above.

Clicking the "NPU" heading text in the model picker. Before, the section stays folded. After, it opens:

NPU heading click, before vs after

The NPU section opened. The setup text is plainer, and the "Powered by FastFlowLM ... and Lemonade" line is gone. It is also gone from the Hub's NPU list:

NPU setup notice, before vs after

Every collapsible section opens from its label, not only from the chevron. Here, "Other models" on the On Device tab:

Section label click, before vs after

Follow-up changes

  • The "Powered by FastFlowLM and Lemonade" credit line is removed from the NPU setup notice and the Hub NPU list.
  • A full NPU context is now read from active_kv_tokens. total_tokens came up 3 short when thinking was off, because the empty think block counts four context tokens as one generated token, so the context-window notice did not show.
  • A request with an MCP image that names an NPU model is now refused before the switch. Before, it unloaded the serving model first.
  • The NPU is off by default. Start Studio with UNSLOTH_STUDIO_ENABLE_NPU=1 to use it. Without the flag, an XDNA2 NPU reports supported: false, so the picker and Hub show no NPU section, and NPU loads, the runtime start, and unsloth run / unsloth chat with an NPU id are refused with a message naming the flag. The screenshots above were taken with the NPU on.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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 ⚠️ Failed 2026-10-15T04:38:08.879403Z 5906fa6 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.

@oobabooga

Copy link
Copy Markdown
Member Author

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 15, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 15, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 15, 2026
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.

2 participants