Repository navigation
[Feature] AMD NPU: list new models that run on a Ryzen AI laptop first in the picker and Hub - #17513
Conversation
The NPU list followed the backend's alphabetical order, so d3 and Gemma sat above Qwen3.8 and Qwen3.6. Qwen models now lead, newest version first, and everything else keeps the backend's order after them.
… Strix laptop Newest-Qwen-first put qwen3.6-moe 35B-A3B and qwen3.8 27B at the top, which fail to load or take hours to download on a Ryzen AI laptop. Recommend qwen3.5 9B/4B, Gemma 4, gpt-oss, LFM3 and the other new small models first; the rest keep Lemonade's order.
|
Screenshots of this PR's change: Model picker, NPU filter: qwen3.5:9b, qwen3.5:4b, gemma4-it:e4b, gpt-oss:20b, lfm3:1.7b first. Hub, NPU filter: the same order.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
… fully, then fail at load with no warning (unslothai#17531) On Windows the AMD NPU can only map about half of system RAM (lemonade-sdk/lemonade#839; the failure surfaces as ROCm/FastFlowLM#904). Unsloth Studio checked nothing against that: the NPU rows show size only, and download and load go ahead. On a 32 GB Windows laptop, qwen3.8-mtp:27b and qwen3.8-dflash2:27b (about 18 GB) and qwen3.6-moe:35b-a3b (about 22 GB) download fully and then fail at load with a generic error. The backend now computes an NPU memory window (Windows: half of total RAM; other systems: total RAM minus a 2 GB reserve) and reports it as `memory_window_gb` in `/api/npu/status`. Each catalog model gets `memory_needed_gb` (size plus a flat 1 GB for context buffers and the runtime) and `fits_memory` (`null` when size or RAM is unknown). The picker row is tagged "May not fit NPU memory", the Hub row shows "Needs about X GB of NPU memory; this PC can give the NPU about Y GB.", and the same text is a warning toast when you download or load such a model. It warns and never blocks: the 50% figure comes from the linked issues, and the 1 GB margin and 2 GB reserve are estimates, none of them measured here. ## Tests - `studio/backend/tests/test_npu_memory_fit.py`: with RAM and OS pinned, 32 GB Windows flags all three flagship models, 64 GB Windows flags none, 32 GB Linux uses the reserve rule and flags none, unknown RAM flags nothing, and status reports the window. - `studio/frontend/tests/npu-api.test.ts`: the warning text and tag for a flagged model, and none when the model fits, is unknown, or the backend predates the field. Tested on Windows 11, Ryzen 9 9950X + 2x R9700, no NPU: the backend and frontend unit tests above, with RAM and platform pinned. Not run on a Ryzen AI NPU. ## Screenshots NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no speed numbers. Before | after: fork phase stack, phase-0 base `5d5c138` | phase 1 `ac3e06e`. This PR's head `6c8ff92` is part of `ac3e06e`. Light mode, mint theme, glass on, same on both sides. Before | after: the picker tags qwen3.6-moe-35b-a3b and both Qwen3.8 27B models "May not fit NPU memory" (32 GB RAM reported, so about 16 GB for the NPU). The new order on the after side is unslothai#17513.  Before | after: Hub rows say what each model needs against what this PC can give the NPU (about 22, 18 and 19 GB against about 16 GB).  Before | after: downloading qwen3.8-dflash2-27b-FLM now warns that it may not load, and still downloads.  Also checked by building Unsloth Studio from this PR's merge base (left) and head (right), on the same spoofed AMD NPU: Model Hub, format NPU, on a 16 GB machine: models larger than the NPU memory window carry a memory warning.  --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Daniel Han <[email protected]>
…the Hub (unslothai#18059) The composer model picker's NPU section listed FastFlowLM's internal ids (`d3-edge-FLM`, `gemma4-it-e4b-FLM`, ...) in the backend's alphabetical order. The Hub's NPU list already shows Hugging Face names (`Qwen3.6-35B-A3B-NPU2`) in the curated order from unslothai#17513. unslothai#17610 renamed the old picker and the Hub, but the composer picker from unslothai#17517 builds its own NPU rows, so it kept the raw ids. The picker now builds its NPU rows with the Hub's own helpers, `npuRowsFor` and `npuDisplayName`, so both lists match. Rows still load by the `lemonade:<id>-FLM` path, and sizes show as before. On Device's default Recent sort kept re-sorting never-loaded NPU rows by name, so device rows carry an optional `rank` and the sort breaks date ties by date, then rank, then name. Name and Size sorts are unchanged. **Tests.** `tests/composer-npu-rows.test.ts` covers names, order, the `-FLM` load path, and the Recent sort with mixed inventories. Typecheck and the full frontend suite pass (16471 pass, 0 fail). **Screenshots.** Composer picker, Discover tab, NPU section, light mint theme, with `/api/npu` answers mocked in the browser (the change is frontend only). The "Couldn't reach Hugging Face" banner is the mock having no Hub feed. | Before (main) | After | |---|---| | <img src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/c6615d8e2fa7d0af28cb584321d143827631ec7c/before.png" width="380"> | <img src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/c6615d8e2fa7d0af28cb584321d143827631ec7c/after.png" width="380"> | --------- Co-authored-by: Daniel Han <[email protected]>
…wLM and converter (Qwen3 14B offered, LFM3 hidden) (unslothai#18050) NPU model support now comes from what is installed instead of hand-kept lists: - `GET /api/npu/compat` (`core/inference/npu_compat.py`) reads FastFlowLM's `model_list.json`, each catalog model's `config.json` (downloaded copy, else its Hugging Face repo, cached per listing) for layers / hidden size / experts, and the pinned Q4NX converters' `ModelArchNames` and `_QWEN35_GEOMETRY`, parsed with `ast` and never imported. It never starts the runtime. - One tag per model: "Runs on NPU", "Convert, then runs", "Converts, won't run", "Not supported", shown in the composer picker, the Hub NPU list and the Q4NX convert card. - Removed the hand-kept `Q4NX_ARCHITECTURES` / `Q4NX_SIZES` (frontend) and `_NPU_SHAPES` (backend export guard). - `NPU_POPULAR`, six checkpoints, replaces unslothai#17513's recommended list as the one order every NPU list uses. - The composer picker names NPU rows with unslothai#17610's `npuDisplayName` and orders Discover's NPU rows with `npuRowsFor`. Base `mirror-base/npu-compat` is upstream main at a2b1f68. ## Screenshots Composer model picker, On Device tab. Both Studios were built from source (left: the merge base, right: this PR). The `/api/npu/*` answers come from a real Strix Halo XDNA2 capture and the FastFlowLM 1.0.12 compat table. Each NPU row now shows its support tag ("Runs on NPU").  Without a supported NPU, `GET /api/npu/compat` returns an all-unknown table and installs and fetches nothing (checked on a CPU host and on a Colab T4). --------- Co-authored-by: Daniel Han <[email protected]>


The NPU section of the model picker (and the Hub's NPU list, which shares
npuRowsFor) showed Lemonade's order: downloaded models first, then alphabetical, so the sevend3-*decision models led the list and the newest chat models were buried.NPU models are now ranked by a short curated list: the AMD NPU launch blog's headline models first (Qwen3.6-MoE 35B-A3B, Qwen3.8 MTP 27B and Qwen3.8 DFlash2 27B), then new models that run on a Ryzen AI laptop: Qwen3.5 9B and 4B, Gemma 4 E4B, gpt-oss 20B, LFM3 1.7B, Nemotron 3.5 Bolt E4B, Qwen3-VL 4B, Gemma 4 E2B, Qwen3.5 2B and 0.8B, Phi-4 mini, Llama 3.2 3B. Everything else keeps Lemonade's order after them. The list matches on FastFlowLM checkpoints (
qwen3.5:9b), so it doesn't depend on Lemonade's id format.The three headline models need about 17 to 22 GB, more than a 32 GB Windows laptop lets the NPU map; #17531 marks them "May not fit NPU memory" on such machines, so it should land with or before this.
Tested:
tests/npu-api.test.ts(12 pass, ordering test uses real checkpoints) and frontend typecheck on Windows 11, no NPU.Screenshots
NPU spoofed: fake Lemonade/FastFlowLM on a Windows 11 PC with no NPU; no speed numbers. Before | after: fork phase stack, phase-0 base
5d5c138| phase 1ac3e06e. This PR's head221531eis part ofac3e06e. Light mode, mint theme, glass on, same on both sides.Before | after: the picker's NPU list now leads with the launch blog's models, qwen3.6-moe-35b-a3b, qwen3.8-mtp-27b and qwen3.8-dflash2-27b as rows 1 to 3, then the laptop-sized models (qwen3.5-9b, qwen3.5-4b, ...); before, downloaded models sorted first and the d3-* decision models followed. The "May not fit NPU memory" tags elsewhere are #17531.

Also checked by building Unsloth Studio from this PR's merge base (left) and head (right), on the same spoofed AMD NPU:
Model Hub, format NPU: the launch models now lead the NPU list.