Repository navigation
feat(npu): offer GAIA's Gemma on the Ryzen AI NPU, GPU stays default - #5892
Conversation
On a PC with a Ryzen AI NPU, the Agent UI and TUI now offer the NPU builds of GAIA's two default models (gemma4-it-e4b-FLM, qwen3.6-moe-35b-a3b-FLM), judged against the NPU's system RAM and hidden on PCs without one. Plain `gaia init` installs the NPU backend when an NPU is present; `--profile npu` defaults to Gemma, since Qwen's agent turns take minutes on the NPU. Also stops reading a stream at a native tool call: FLM keeps generating an invented tool result, which left the next turn empty.
|
Verdict: Approve with suggestions This puts GAIA's two default models on the Ryzen AI NPU, sizes them against the NPU's own memory, and fixes the empty follow-up replies caused by FLM writing past its own tool call. The design holds up, the Python and Go fit rules match, and tests cover each new rule. One edge case should be fixed before merge:
Smaller items:
The stream change also affects the GPU path. As the description says, watch Real-world evidenceN/A: no evidence bundle was produced for this run, and the change needs NPU hardware to exercise. This verdict rests on static review plus a local run of the TUI's Go tests ( 🔍 Technical details🟡 A corrupt config raises before the UI setup can run (
Go's Please add a test that writes 🟢 Picking a GPU model doesn't undo the NPU profile ( With 🟢 Run-on detection in the stream is broad (
🟢 gofmt ( There are two blank lines after Strengths
|
…n NPU models A corrupt config no longer blocks the Agent UI's setup, which is the step that resets it. The stop-at-tool-call fix now applies only to FLM models, so the GPU path is unchanged. The NPU guide says to return to the GPU with `gaia init`.
Qwen3.6's FLM build passed tool selection but its agent turns took minutes, so GAIA no longer recommends it in the Agent UI or TUI. Only NPU models whose agent evals ran are offered.
…nded Gemma on the NPU is slower than on the GPU, so it is only ever the user's pick: the picker no longer shows it under "Recommended" with a star.
Gemma 4 E4B read 16 tool schemas every step for features it never passed in the evals: the SQL scratchpad, email, image generation and the skill hub. It now runs a "compact" feature tier without them, on the GPU and the NPU alike, since the tier belongs to the model. Larger models keep everything. Skills that need a withheld tool are hidden from the catalog, and loading one says it needs a larger model. GAIA_FEATURE_TIER forces a tier for comparison. Measured with run_eval_lane.py, before -> after: - tool_selection: GPU 3/7 -> 4/7, NPU 3/7 -> 4/7 (multi_step_plan now passes) - gaia_core: GPU 12/15 -> 12/15, NPU 12/15 -> 12/15 (a 10/15 run re-ran clean with the baseline's exact failures) - NPU time to first token on tool_selection 23.5 s -> 8.7 s, time per turn 174 s -> 95 s; the GPU's prompt cache already hid the cost
… feature Asked for email or image generation on Gemma, the agent says it can't; only a direct load of a hidden skill gets the needs-a-larger-model refusal.
|
🟡 Switching models mid-chat keeps the first model's feature set. Gemma is the default on most PCs, so most chats start on it and get the reduced tool set. When the user then switches to Qwen or Claude in the model list, the chat keeps that reduced set. Scratchpad, email, image generation and the skill hub stay missing for the rest of the conversation. Loading a skill that needs one of them is also refused with "Claude … is not offered. Tell the user this needs a larger model", which is wrong for that model. The reverse also happens: a chat that starts on Qwen and switches to Gemma keeps every feature, including the ones this PR exists to hide from Gemma. Please recompute the features when the model switches, and add a test that switches a Gemma session to a full-tier model and checks the tools come back. 🔍 Technical details
The in-place switch (
One possible fix: in |
Choosing Gemma 4 E4B NPU in the model list said "it is not downloaded", and the next launch could not restore it either. The switch check dropped any model labeled "audio" as not a chat model, and the NPU build is labeled "audio" as well as "chat"; the picker already let "chat" win.
…-models-9d9a03 # Conflicts: # docs/guides/gaia.mdx # hub/agents/chat/python/gaia_agent_chat/agent.py # hub/agents/gaia/npm/CHANGELOG.md
A chat started on Gemma kept Gemma's reduced tools after switching to Qwen or Claude, and loading a skill there was refused as needing a larger model; a chat started on Qwen kept every tool after switching to Gemma. Withheld tools are now kept aside instead of dropped, and the switch recomputes the features for the new model in both directions, rolling back with the rest of the switch if it fails. The scratchpad and image tools are built from the config alone so a larger model has them to offer.
…n a switch Building the chat agent recomputed the tier from the model id, which agents built without the base constructor do not carry consistently: the manifest tool-count check counted Gemma's reduced set, and a bare agent had no model id at all. Construction withholds by the tier the agent already has, as before; only a model switch recomputes it from the new model.
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
…n" reply On Gemma 4 E2B (NPU), every Agent UI chat answered with an empty json code block (amd#6008). The model was marked as unable to take native tools, so the flagship sent them as JSON in text; E2B wrapped its reply in a code fence and the chat showed only the opening "```json". FastFlowLM 1.0.7 serves native tool calls for E2B, streamed or not, so it now gets them the way E4B does. Tests that used E2B as their example of a model without tool calls now force that path instead; the profilespec row10 output is byte-identical.
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
A fresh download of the NPU Gemma must send Lemonade the model name alone; a recipe or checkpoint would make Lemonade treat it as a user-model registration and reject it (amd#1655). Every FLM model in the registry and the TUI's NPU recommendation are now checked at the request body, not just at the registry entry.
|
A fresh download of the NPU Gemma sends a valid request: Lemonade lists 🔍 Technical details
|
…-models-9d9a03 # Conflicts: # src/gaia/ui/routers/providers.py # tests/unit/test_model_device_and_context.py
|
This changes the flagship agent on the default GPU model, not just the NPU, so it needs a flagship eval run before merge. The compact tier is set on Next step: dispatch 🔍 Technical details
|
…-models-9d9a03 # Conflicts: # tui/internal/lemonade/catalog.go # tui/internal/ui/providers/model.go
…-models-9d9a03 # Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
The GPU model stays the default and the NPU model is an option: an NPU
pick persists through default_model and last_model like any other pick,
so the Agent UI reopens on it and a GPU pick switches back. Setup no
longer follows a saved npu profile (configured_setup_profile /
ConfiguredProfile removed), which also stops it re-requiring the NPU
model after the user picks a GPU one.
- gaia init --profile npu writes last_model too, so both UIs start on
the NPU model even for a user who picked a model before; a Claude or
cloud pick is left as it is.
- Dynamic tools on Gemma no longer fail the loader's drift check: tools
withheld by the feature tier are exempt.
- A switch to Gemma unloads loaded skills that need a withheld tool and
says so; the empty-library hint stops pointing Gemma at the skill hub.
- init sizes the context window by the chat model's device, so an NPU
default_model under plain init gets its FLM window.
- The npu note after init names a way back that changes the model.
- build_plan("npu") on a PC without an NPU raises SetupPlanError.
- ChatAgent changes ported to gaia_agent.chat_agent (moved on main);
CHANGELOG entry moved to Unreleased; SKILL.md and the NPU guide
describe the compact tier and GPU-default behaviour.
|
Merged main and changed the behaviour so the GPU model stays the default, with the NPU model offered as an option that, once picked, the Agent UI reopens on. All earlier review findings are addressed. The flagship eval runs on the next RC tag. 🔍 Technical details
|
On a PC whose default is Gemma, a chat built on Claude took the compact tier from the local default model id, so it lost the scratchpad, email, image generation and the skill hub. The tier now follows the Claude model whenever use_claude is set, in both Agent and ChatAgent. Also tests the skill unload through the real local-switch path, and the post-init NPU note names the command that changes the model for agents.
Brings amd#5892 in and keeps what it does not cover: a pasted FastFlowLM link resolves to its built-in, and a download installs the NPU backend for anyone who has not re-run setup. FLM models no longer stop at a fixed 32K. E4B gets the smaller of its 128K maximum and what memory holds; on a real NPU it read a 79,233-token prompt at 128K. E2B stays at FastFlowLM's default on Automatic because it has no size on record, and offers up to 128K by hand. A size picked in Settings or set with GAIA_CTX_SIZE is no longer shrunk. Startup now asks an FLM chat model for its own window instead of the device profile's, which is what reloaded it on every start. The outgoing model is not reloaded at the incoming model's window.
Pasting a FastFlowLM link failed with "has no GGUF files", a Download of an FLM model failed on any PC that had not run setup since amd#5892, and FLM models were stuck at a fixed context size. Now a pasted link resolves to the matching model or says where it already is, Download installs the NPU backend first, and an FLM model's window is the smaller of what the model supports and what memory holds, with a manual override that is no longer shrunk. Measured on the NPU: Gemma 4 E4B read a 79,233-token prompt at a 128K window and answered from its first line. With 13.8 GB free it loaded at 96K on its own; with plenty free, at 128K. Builds on amd#5892 and keeps its model list, feature tiers and native tool calls. Refs amd#5519, amd#5215. <details> <summary>🔍 Technical details</summary> - **Window:** E4B declares a 128K maximum (what Lemonade reports) and a measured 22 KiB/token, so the existing scaling and free-memory fit apply against system RAM. Lower-memory PCs stay at the 64K floor, and free memory can still take it to 32K. The 32K clamp in `resolve_ctx_size` and the FLM cap are gone; `npu_ctx_ceiling` is now `npu_default_ctx`. - **E2B:** it has no `size_gb` on record because a size would add memory refusals for the email agent, so Automatic stays at FastFlowLM's 32K default. Settings offers it up to 128K, marked as unchecked against memory. - **Measurements:** E2B and E4B both loaded and answered at 32K, 64K, 128K and 256K. A 40K prompt at a 32K window is refused loudly with "Max length reached". - **Reload bug:** `ensure_ready` compared a resident FLM model to the device profile's window. It now asks the model for its own window, and does not reload an outgoing model at the incoming model's window. - **Repo-to-model lookup** reads `src/model_list.json` from the exact FastFlowLM release Lemonade reports, cached per release. `Gemma4-E4B-IT-NPU2` backs both `gemma4-it:e4b` and the single-turn `gemma4e-flash:e4b`; single-turn, embedding and transcription builds are not chat models. - **Backend install** sits in `pull_model`, `pull_model_stream`, the Settings download and the TUI's `Pull`. The TUI row is now downloadable rather than a "run `gaia init`" dead end. - **Saved models:** `custom_models` entries may be a built-in `*-FLM` id as well as `user.*`. An older build reading such a config rejects it until the entry is removed. - **`is_tool_calling_model`** reads an added model's saved flag, so a tool-less added GGUF model leaves the native tools path. - **Eval:** E4B on the NPU can now load above 64K on large PCs, which amd#5892's numbers did not cover. GPU models are unchanged. Watch `tool_selection` and `gaia_core` on the NPU when that baseline exists (amd#5519). </details> ## Test plan - [x] `python -m pytest tests/unit`: 34,036 passed before the last 3 expectation fixes, which then pass. Remaining failures are not from this change: 10 need `pypdfium2`, missing here; `test_chat_system_prompt_budget` fails on the base commit; one `test_lemonade_embedded` archive test fails under parallel load and skips alone. 20 more failed only in the parallel run on a shared machine and pass when run alone - [x] `cd tui && go test ./internal/...` - [x] `python util/lint.py --black --isort --flake8`, and pylint on the changed Python files - [x] Cold private Lemonade 2026.43.3 on a Ryzen AI MAX+ 395: add by link, Download installs the backend, pulls and loads on the NPU (before the merge with amd#5892) - [x] Agent UI on real NPU after the merge: Automatic loaded E4B at 131,072 tokens, and at 98,304 with 13.8 GB free. A manual 64K loaded at 65,536 and answered - [x] Agent UI: the reported link passes every check and points at the model list - [ ] TUI against a real server after the merge. Go tests only - [ ] On a PC without an NPU: neither list shows an FLM model, and a FastFlowLM link says why (unit tests only) - [ ] On a 16 GB Ryzen AI PC: E4B loads and answers. Tested only on 128 GB
…messages (amd#6467) Several skill messages sent the model and the user to commands that fail or claimed things that don't happen. Installing a skill the agent already bundles told the model to load the install, but the bundled copy is what loads. `gaia skill import` without `--allow-experimental` exits 4 for a skill with code, `gaia skill deltas --drop-section` without `--scope` exits 2, and `gaia skill info --remote` doesn't exist. The skills catalog said `gh` is refused until a skill loads, but it actually asks the user to approve each command. Now every named command runs as written and every status claim matches the code. **Needs a flagship eval:** the catalog line is in every system prompt, and tool results and one tool docstring changed. Please re-run `gaia_skills_lifecycle`, `gaia_skills_capture` and `gaia_skills_tasks` in `eval_flagship.yml`. ## Test plan - [x] New tests: shadowed-install message and `shadowed_by`; the import, drop-section, install and search commands parse with the real `gaia skill` argparse; the tainted-turn refusal and the not-loaded refusal wording; the undo notice; the compact-tier hint names `capture_skill` - [x] `python -m gaia.cli` in a temp home: `skill import <dir>` exits 4 and with `--allow-experimental` exits 0; `skill deltas --drop-section` exits 2 and with `--scope` exits 0; `skill info --remote` exits 2; `skill search` exits 0 - [x] Skills, agent and flagship suites: 8162 passed. The 9 failures are 3 that also fail on main, a test that passes on rerun, and 5 that pass when run alone - [x] `util/lint.py --all`: black, isort, flake8 and the tool-description budget pass. Pylint's 2 errors are Windows-only, in files this PR doesn't touch - [ ] Flagship eval: `gaia_skills_lifecycle`, `gaia_skills_capture`, `gaia_skills_tasks` <details> <summary>🔍 Technical details</summary> Model-visible strings changed: - `CATALOG_HEADER` (system prompt): "some pre-approve a CLI (such as gh) — until the skill is loaded, each of its commands waits for the user's approval." The golden fixture `non_claude_system_prompt.txt` is updated. - `install_skill` result: new `next_step` and `shadowed_by` when a bundled copy outranks the install; new `next_step` when the host has the skill turned off. - `load_skill` refusal for an imported skill with code: the command now includes `--allow-experimental` and is shell-quoted. - `load_skill` docstring, Returns: a missing CLI with no substitute refuses the load. - `list_skills` compact-tier hint: hub installs need a larger model, and `capture_skill` still works. - `remember_skill_lesson` "not loaded" error: says the lesson can be saved on the user's next message. - `remember_skill_lesson` empty-text error: `gaia skill deltas <skill> --scope <scope> --drop-section <section>`. - `remember_skill_lesson` success notice: "Undo, which takes effect when GAIA next starts: …" - `validate_delta` provenance refusal: "A tool already ran this turn, and anything a tool returns — a web page, an email, a skill's text, a command's output — …" The first clause appears only for `tool_content`. - Hub errors (pin, SKILL.md fetch): `gaia skill install <name>[@<version>]` and `gaia skill search <name>` replace `gaia skill info --remote`. - Skill-format errors: anchors are now `#the-metadata-gaia-namespace` and `#tools-vs-tools_required-%E2%80%94-never-conflate-them`, checked against the live page's ids. - Permission refusals: the sandbox pointer is now open amd#2863 instead of closed amd#1019. Decisions: - **C5:** `load_skill` still taints the turn. A loaded skill's text is third-party, and `test_even_a_skill_listing_taints_the_turn` pins that. So the guidance changed, not the taint. - **C10:** `capture_skill` stays on the compact tier. `test_gemma_keeps_installed_skills_and_documents` asserts that on purpose, and amd#5892 withheld only the hub. The comment and hint now say so. - **`cli_setup` bundle:** it's defined once in `DOC_BUNDLES` and once in `FULL_BUNDLES`, one per profile, like `shell_session`. That isn't a duplicate, so it's unchanged. - **Overlap:** amd#6463 adds imports on the line next to the one this PR adds in `install_skill`. Whichever merges second needs a trivial rebase. </details>
…out (amd#6736) On Linux, a Ryzen AI Max PC with a large GPU memory carve-out was told it has no NPU. `gaia init --profile npu` stopped with "Lemonade reports no available AMD NPU", and setup hid the NPU models. A 128 GB Strix Halo set to 64 GB of VRAM is a common setup for local LLMs and hits this. It also fails the release gate's Linux NPU chat job on every RC since rc10 (runs [42022209446](https://github.com/amd/gaia/actions/runs/42022209446), [41973946000](https://github.com/amd/gaia/actions/runs/41973946000), both on runner sjlab-stx-halo-19). With this fix, such a PC gets its NPU offered and sized correctly. This PR alone won't turn that job green. Runner sjlab-stx-halo-19's locked-memory limit is 7.8 GB and the NPU model needs about 10.6 GB, so the job will next fail on GAIA's own "locked-memory limit" message. That's the accurate error, and the fix is on the runner. <details> <summary>🔍 Technical details</summary> - Lemonade's `Physical Memory` is installed DIMM capacity on Windows (WMI `Win32_PhysicalMemory`) but `/proc/meminfo` MemTotal on Linux, which already excludes the carve-out. `_npu_memory_gb` subtracted the carve-out on both, so on halo-19 it computed 62.4 − 64 → 0 → `None` → "no NPU". Lemonade itself logged `NPU hardware: Yes`. - The carve-out now comes off only when `OS Version` starts with `Windows`. The Go mirror (`tui/internal/lemonade/capacity.go`) gets the same rule, so the TUI picker agrees. - The old `STRIX_HALO_128` fixture claimed to be a Linux report but carried 128 GB of Physical Memory, which a Linux Lemonade never sends. That is the wrong assumption behind the bug, so it now carries MemTotal. - Introduced with the NPU profile in amd#5892. </details> ## Test plan - [ ] `python -m pytest tests/unit/test_flm_models.py tests/unit/test_npu_twin_models.py` passes. The four new Linux cases fail on `main` with the CI job's exact "no available AMD NPU" error. - [ ] `cd tui && go test ./internal/lemonade/` passes. - [ ] After the runner's memlock is set to unlimited, dispatch `test_npu_agent_chat.yml` and confirm the Linux job gets past "Downloading models".
On a Ryzen AI PC, GAIA can now run its Gemma 4 E4B on the NPU (
gemma4-it-e4b-FLM), leaving the GPU free. The GPU model stays the default: plaingaia initinstalls the NPU backend when an NPU is present, and the Agent UI and TUI model lists then offer the NPU model as an option, only where the NPU's system RAM holds it. Pick it once and it stays picked; the Agent UI starts on it the next time it opens, and picking a GPU model switches back.gaia init --profile npumakes it the default from the start.It also fixes empty follow-up replies on the NPU (FLM kept writing an invented tool result after a native tool call; GAIA now stops reading at the call, NPU models only), and gives Gemma 4 E2B on the NPU native tool calls, which fixes the bare
jsonreply in #6008.Gemma 4 E4B, on the GPU and the NPU alike, stops being offered four features it failed in every eval: the SQL scratchpad, email, image generation and the skill hub. That cuts 16 tool schemas from every step. Larger models such as Qwen keep everything, and switching models mid-chat gives the features back or takes them away. This changes the flagship on the default GPU model on most PCs, so the flagship eval on the next RC must be checked: email, scratchpad/data-analysis and skill-hub scenarios will now get "needs a larger model" on Gemma.
🔍 Technical details
last_model(Agent UI and TUI restore) anddefault_model(setup honours a localdefault_modelon every profile). Setup no longer follows a savednpuprofile, so picking a GPU model is enough to go back.--profile npuwrites both keys unless they name a cloud or Claude model.src/gaia/agents/base/model_features.py), set per model byModelRequirement.feature_tier;GAIA_FEATURE_TIER=full|compactforces one. With dynamic tools on, withheld tools are exempt from the loader's drift check. A switch to Gemma unloads any loaded skill that needs a withheld tool and says so.Test plan
python -m pytest tests/unit/test_npu_twin_models.py tests/unit/agents/test_gemma_tool_echo.py tests/unit/test_init_command.py tests/unit/agents/test_model_features.py tests/unit/installer/test_init_model_choices.py tests/unit/chat/ui/test_providers_router.py hub/agents/gaia/python/tests/test_compact_tier.pycd tui && go test ./internal/...tool_selection,gaia_core, email, scratchpad and skill-hub categories againsttests/fixtures/eval_baselines/gaia-flagship/