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

Reached Codex review convergence at oobabooga#375.

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
@oobabooga
oobabooga merged commit 2de9425 into unslothai:main Oct 16, 2026
tsautier pushed a commit to tsautier/unsloth that referenced this pull request Nov 6, 2026
…e NPU UI (unslothai#16834)

AMD shipped a FastFlowLM fix that Studio users never got: Studio still
pinned FastFlowLM v1.0.10 and Lemonade 2026.43.3, because the daily pin
update workflow cannot open its pull request in this repository. This PR
does four things.

## 1. Update the NPU runtime

`studio/lemonade_prebuilt_pins.json`:

| | Before | After |
|---|---|---|
| FastFlowLM | v1.0.10 | v1.0.12 |
| Lemonade | 2026.43.3 | 2026.44.1 |

Users get this with the next Studio release. Their first NPU use after
updating upgrades the runtime in place, as on every pin change.

Lemonade stops at 2026.44.1 on purpose. The newest release, 2026.45.3,
ships a Linux `lemond` that needs glibc 2.43 and OpenSSL 3.2, so it does
not start on Ubuntu 24.04 (glibc 2.39, OpenSSL 3.0).

## 2. Skip pin updates that need a newer glibc

`scripts/update_lemonade_pins.py` is what the daily pin update workflow
runs to propose new pins. It does not run on users' machines.

- **Before:** it always proposed the latest release, so it was proposing
Lemonade 2026.45.3, which would have broken NPU chat on Ubuntu 24.04.
- **After:** it checks each newer release's Linux binaries and skips any
that need a glibc newer than 2.39 (Ubuntu 24.04; FastFlowLM itself
already needs 2.39). It proposes the newest release that passes and logs
the skipped ones.

Hash and size checks still run first, so a bad download is still an
error rather than a skip. Run against main's pins, the script now
produces exactly this PR's pins file.

## 3. Show the runtime versions in the UI

A faint `FastFlowLM v1.0.12 · Lemonade v2026.44.1` line, shown once the
NPU runtime is set up, under the NPU models in the Hub and in the chat
model picker (screenshots in section 4). It reads the `versions` field
`/api/npu/status` already returns. unslothai#13797 removed the "Powered by" line
that used to carry these versions.

<img width="3432" height="704" alt="pr16834_hub_npu_versions"
src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-npu-runtime-update/pr16834_hub_npu_versions-78bb5c851e58.png"
/>

## 4. List GPU models before NPU models in the chat model picker

- **Before:** on the Recommended tab, an NPU group sat at the top of the
list, above the Unsloth models.
- **After:** the list holds only GPU models. An always-visible "NPU
models" footer below it opens the picker's NPU filter, which lists the
NPU models with the setup card or the version line. The footer says how
many NPU models there are, how many match a search, or "Set up the AMD
NPU".

The NPU group could not simply move below the Unsloth models: that list
loads more models as it is scrolled, about 30 pages and 350 rows on this
machine, so the group would sit around 11,000 px down. Search follows
the same rule, so NPU matches no longer appear above the GPU results.
The On Device tab already lists NPU models after the GPU groups and is
unchanged. The Eject model button still floats over the bottom of the
list, now just above the footer.

<img width="2268" height="1166" alt="pr16834_picker_default"
src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-npu-runtime-update/pr16834_picker_default-4f10b8ec3a17.png"
/>

<img width="2268" height="1036" alt="pr16834_picker_npu_opened"
src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-npu-runtime-update/pr16834_picker_npu_opened-a1a560b307be.png"
/>

Screenshots: main (`0ab3f0773d`) vs this PR at `0e1f74712e`
(`d26ae020a3` after a rebase that changed only a comment in the
frontend), two fresh installs, English locale. This machine has no NPU,
so `/api/npu/*` was mocked as a ready XDNA2 runtime reporting the
versions the DevLab runs below reported.

## Verification

- On the AMD DevLab Strix Halo machines, Windows 11 and Ubuntu 24.04,
with a real NPU: I enabled the NPU with main's pins, switched to this
PR's pins, and the first use upgraded the runtime in place to FastFlowLM
v1.0.12 and Lemonade 2026.44.1. `qwen3-0.6b-FLM` then downloaded, loaded
and answered a chat request correctly (74 and 81 tok/s).
- On Linux Mint 22 (glibc 2.39), Lemonade 2026.44.1 installs and runs,
while 2026.45.3 fails with `GLIBC_2.43 not found`.
- `test_update_lemonade_pins.py`, `test_install_lemonade_prebuilt.py`
and `test_npu_backend.py`: 93 passed. The new tests cover the glibc
fallback, a release exactly at the limit, all releases too new,
candidate tags, ELF-only scanning, and hash checks running before the
glibc check.
- Frontend: the NPU and picker node tests (43 passed), `npm run
typecheck`, and eslint on the changed files. The full node suite has 17
failures in 14 files: the two that read the picker fail the same way
with main's picker files, and the other 12 do not reference the picker
or NPU code.
- In a running Studio: the picker footer before and after NPU setup, the
NPU filter it opens, and the Eject model button's position with a GGUF
loaded.

## Not in this PR

- The pin update workflow still cannot open its PR. That needs "Allow
GitHub Actions to create and approve pull requests" under Settings >
Actions > General, or a GitHub App token in `lemonade-pins-update.yml`
(which would also run CI on its PRs).
- `d3-edge-FLM`, a Decision model new in FastFlowLM 1.0.12, does not
load on either DevLab machine (`flm serve d3:edge` exits about a second
after it starts). It was not loadable before this PR either, since
v1.0.10 does not have it.


## Maintainer follow-up

- `scripts/update_lemonade_pins.py` now checks every system library the
Linux build links against, not only glibc: a release is skipped if it
needs a newer GLIBC, GLIBCXX, CXXABI or OPENSSL symbol version than
Ubuntu 24.04 ships (2.39, 3.4.33, 1.3.15, 3.0.9). Lemonade 2026.45.3
needs both GLIBC 2.43 and OPENSSL 3.2.0, so the OpenSSL break alone
would have shipped a `lemond` that cannot start, even if a later build
fixed glibc. Run live against main's pins, the script still produces
exactly this PR's pins file and logs `needs GLIBC 2.43 > 2.39, OPENSSL
3.2.0 > 3.0.9`.
- Picker: clicking the "Set up the AMD NPU" footer while a search is
active now still shows the setup card, instead of an empty NPU view.
- Real NPU runs on the AMD CI Strix Halo machines (XDNA2), Linux and
Windows 11: main's pins installed and answered; this PR's pins then
upgraded the same install in place on first use to FastFlowLM 1.0.12 and
Lemonade 2026.44.1. `qwen3-0.6b-FLM` gave the same greedy reply as
before, at the same decode speed (Linux 67.9 vs 67.9 tok/s, Windows 65.6
vs 65.4 tok/s).

Before (main) / after (this PR), chat model picker, `/api/npu/*` mocked
as a ready XDNA2 runtime:

![Picker default list: NPU group above the Unsloth models before, GPU
models with an NPU footer
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16834/pr16834_pair_00-15f244449e67.png)

![NPU view: no runtime versions before, FastFlowLM and Lemonade versions
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16834/pr16834_pair_01-7b33f4b813b9.png)

---------

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.

2 participants