Skip to content

feat(npu): offer GAIA's Gemma on the Ryzen AI NPU, GPU stays default - #5892

Merged
kovtcharov-amd merged 25 commits into
amd:mainfrom
kovtcharov:kalin/npu-flm-models-9d9a03
Nov 1, 2026
Merged

kovtcharov-amd merged 25 commits into
amd:mainfrom
kovtcharov:kalin/npu-flm-models-9d9a03

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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: plain gaia init installs 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 npu makes 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 json reply 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.

Gemma 4 E4B, Ryzen AI MAX+ 395 Tool selection Core conversation Time to first token, tool selection
GPU, all features 3/7 12/15 5.7 s
GPU, compact 4/7 12/15 5.8 s
NPU, all features 3/7 12/15 23.5 s
NPU, compact 4/7 12/15 8.7 s
🔍 Technical details
  • An NPU pick persists the same way any pick does: last_model (Agent UI and TUI restore) and default_model (setup honours a local default_model on every profile). Setup no longer follows a saved npu profile, so picking a GPU model is enough to go back. --profile npu writes both keys unless they name a cloud or Claude model.
  • The feature tier lives in one table (src/gaia/agents/base/model_features.py), set per model by ModelRequirement.feature_tier; GAIA_FEATURE_TIER=full|compact forces 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.
  • Qwen3.6's NPU build was evaluated and left out: its agent turns took minutes.
  • Known gap: asked to "triage my inbox", Gemma reaches for the GitHub-triage skill and fails; it then says it can't. NPU profile in desktop app: chat returns empty response and embedding model falls back to GGUF #6008's other half (GPU embedder beside an NPU chat model in the Agent UI) is not addressed here.

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.py
  • cd tui && go test ./internal/...
  • Against a real Strix Halo Lemonade (no model loaded): a fresh setup picks the GPU model, the NPU model is offered (judged on 96 GB of system RAM), and an NPU pick holds under the default profile
  • Flagship eval on the RC tag: compare tool_selection, gaia_core, email, scratchpad and skill-hub categories against tests/fixtures/eval_baselines/gaia-flagship/
  • On an NPU PC: pick Gemma 4 E4B NPU in the Agent UI, chat, restart the UI — it reopens on the NPU model and answers
  • On a PC without an NPU: neither model list offers it

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.
@github-actions github-actions Bot added documentation Documentation changes devops DevOps/infrastructure changes llm LLM backend changes tests Test changes performance Performance-critical changes agents tui Go terminal UI (gaia-tui) daemon Daemon supervisor / sidecar control plane labels Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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:

  • A corrupt ~/.gaia/config.json now stops the Agent UI's setup from starting. The UI reads the config to pick a setup profile before it runs gaia init, and a corrupt file raises an error there. But gaia init is the step that resets a corrupt config, so the recovery path is blocked. The TUI treats an unreadable config as the default profile, and the UI should do the same.

Smaller items:

  • On a PC set up with --profile npu, picking a GPU model in the model list leaves the saved profile at npu. The UI's setup check then keeps requiring the NPU model, which contradicts the guide's advice to switch back by picking a GPU model. Either reset the saved profile when the user picks a GPU model, or have the guide say gaia init only.
  • gofmt flags one Go file.

The stream change also affects the GPU path. As the description says, watch tool_selection and gaia_core on the next RC.

Real-world evidence

N/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 (go test ./internal/lemonade/ ./internal/gaiainit/ ./internal/ui/preflight/), which all passed. pytest isn't installed on this runner, so the Python tests weren't run here. The PR's on-NPU test-plan items (gaia init reports the NPU backend; both pickers list the NPU models only where an NPU is present) still need a real run on a Ryzen AI PC, and output from the real gaia init would be the right proof.

🔍 Technical details

🟡 A corrupt config raises before the UI setup can run (src/gaia/ui/setup_runner.py:107, src/gaia/installer/init_command.py:352)

configured_setup_profile() calls GaiaConfig.load(), which raises GaiaConfigError on a corrupt file. check_args, run_args and run_command all call it, so check(), start() and desktop_setup_error() now raise outside their SetupError handling. Before this PR, the subprocess got to run, and gaia init resets an unreadable config (on_unreadable= in GaiaConfig.update). Only build_plan catches it.

Go's ConfiguredProfile returns Profile on any read or parse error, and profile_test.go asserts that ("an unreadable config is gaia init's to report"). Mirror it:

    from gaia.config import GaiaConfig, GaiaConfigError

    try:
        profile = GaiaConfig.load().profile
    except GaiaConfigError:
        # gaia init reports and resets an unreadable config; don't block it here.
        return DEFAULT_INIT_PROFILE
    return "npu" if profile == "npu" else DEFAULT_INIT_PROFILE

Please add a test that writes not json to the config and asserts setup_runner.check_args(...)[3] == "gaia".

🟢 Picking a GPU model doesn't undo the NPU profile (init_command.py:299-304, docs/guides/npu.mdx:78)

With config.profile == "npu", resolve_init_chat_model(profile="npu") ignores a GPU default_model, so the UI and TUI setup checks keep wanting gemma4-it-e4b-FLM. _record_chat_choice won't overwrite the user's pick, so this doesn't lose data. Still, the guide's "return to the GPU by picking a GPU model in the model list" only fully works after a plain gaia init.

🟢 Run-on detection in the stream is broad (src/gaia/llm/providers/lemonade.py:1013)

if tool_calls and (content or ...) stops on any text after a call, on every backend, and the break also drops the trailing usage chunk for that turn. That's fine for llama.cpp today, which emits narration before calls, but it's the GPU-side risk the description already names. You could limit it to runs_on_npu(self._last_model), or check has_gemma_tool_markup on the run-on text, so the GPU path stays as it was.

🟢 gofmt (tui/internal/gaiainit/gaiainit.go:1874)

There are two blank lines after ConfiguredProfile; gofmt -l lists the file.

Strengths

  • The NPU memory pool (npu_capacity and Capacity.NPU()) is a separate view, and the GPU capacity is left alone. Drift tests check the TUI JSON against MODELS, so the two pickers can't diverge silently.
  • _free_memory_for sends the load-time free-memory check to system RAM for FLM models. The pre-load refusal therefore judges the pool that actually gets used.
  • The tool-echo fix has tests on both sides: a real captured FLM run-on for the parser, and a stream test that asserts the server connection is closed.

…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.
@kovtcharov kovtcharov changed the title feat(npu): run GAIA's Gemma and Qwen on the Ryzen AI NPU feat(npu): run GAIA's Gemma on the Ryzen AI NPU Oct 27, 2026
…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.
@github-actions

Copy link
Copy Markdown
Contributor

🟡 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

model_features is set only at construction: src/gaia/agents/base/agent.py:2564 and hub/agents/chat/python/gaia_agent_chat/agent.py:511. The withheld tools are popped from _instance_tools once, at chat/agent.py:2807.

The in-place switch (_apply_switch in hub/agents/gaia/python/gaia_agent/stdio.py, which SessionRegistry.switch_model reuses for both the TUI and the UI sidecar) changes agent.model_id and calls rebuild_system_prompt(). It never updates model_features and never re-snapshots the tools. So:

  • _withheld_skill_tools keeps applying the original tier to load_skill and to the skill catalog.
  • The popped tools aren't restored, and _offers_image_generation / the scratchpad prompt gate at chat/agent.py:1360 read the stale tier.

One possible fix: in _apply_switch, set agent.model_features = features_for_model(new_id) and rebuild the tool snapshot (re-run _snapshot_tools() and the withhold loop) before rebuild_system_prompt(). Add model_features to _snapshot_switch_state / _restore_switch_state so a failed switch still rolls back cleanly.

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.
…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.
kovtcharov and others added 2 commits October 29, 2026 05:54
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.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

A fresh download of the NPU Gemma sends a valid request: Lemonade lists *-FLM models as built-ins, so the pull goes by name only, and a new test now pins that at the request body for every FLM model and for the TUI's NPU entry.

🔍 Technical details
  • gemma4-it:e4b is in FastFlowLM's model_list.json (flm_min_version 0.9.43), so Lemonade surfaces it as gemma4-it-e4b-FLM once the flm:npu backend is installed; gaia init installs that backend before the download step.
  • New: TestFreshPullRequestShape in tests/unit/test_npu_twin_models.py asserts the /pull body is exactly {"model_name": id, "stream": true}; TestNPUModelPullsByNameOnly does the same for the Go PullRequest.
  • Native tool calls checked on real hardware (Strix Halo NPU) against flm serve v0.9.45, older than the 1.0.7 the PR measured: E4B and E2B both returned a proper tool_calls reply, non-streamed and streamed. So the tool_calling=True flip doesn't need a Lemonade version gate.

…-models-9d9a03

# Conflicts:
#	src/gaia/ui/routers/providers.py
#	tests/unit/test_model_device_and_context.py
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

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 Gemma-4-E4B-it-GGUF, the exact model the flagship baseline was captured on, so most PCs and every CI lane will see 16 fewer tool schemas, a filtered skill catalog and no scratchpad prompt section. The two local categories in the description (tool selection, core conversation) are encouraging but don't cover the categories the PR says will change: email, scratchpad/data analysis and skill hub.

Next step: dispatch eval_flagship.yml on this branch and post the per-category diff against tests/fixtures/eval_baselines/gaia-flagship/ (PASS→FAIL and FAIL→PASS listed separately). The NPU path has no baseline, so the on-device test-plan items still need checking off on real hardware.

🔍 Technical details
  • lemonade_client.py sets feature_tier="compact" on the gemma-4-e4b entry (model_id Gemma-4-E4B-it-GGUF); features_for_model then withholds the scratchpad, email, SD and skill-hub tools in Agent.__init__/ChatAgent, drops the scratchpad prompt section, and filters the skill catalog. Baseline meta.json records model: Gemma-4-E4B-it-GGUF.
  • The NPU stream cut-off in providers/lemonade.py is correctly gated on runs_on_npu. The native-path content drop in agent.py (has_gemma_tool_markup) is not device-gated, so it also applies to the GPU Gemma; it's narrow, but it's part of the same eval surface.
  • No eval_flagship.yml run exists for this branch.

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.
@kovtcharov-amd kovtcharov-amd changed the title feat(npu): run GAIA's Gemma on the Ryzen AI NPU feat(npu): offer GAIA's Gemma on the Ryzen AI NPU, GPU stays default Nov 1, 2026
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

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
  • Corrupt config blocking UI setup / npu profile sticking after a GPU pick: setup no longer reads config.profile at all (configured_setup_profile and Go ConfiguredProfile removed). An NPU pick persists through default_model and last_model, so picking a GPU model is enough to go back.
  • Mid-chat model switch: features are recomputed both ways and rolled back on a failed switch; a switch to Gemma now also unloads loaded skills that need a withheld tool and says so.
  • GPU stream cut-off: gated on runs_on_npu. The has_gemma_tool_markup drop only removes prose beside already-parsed native calls.
  • gofmt: clean.
  • From an independent review pass on the merge: --profile npu now also writes last_model (otherwise a user with an earlier pick reopened on the GPU); Gemma with dynamic tools no longer fails the loader's drift check; init sizes the window by the chat model's device; build_plan("npu") on a PC without an NPU raises SetupPlanError; the post-init note names a way back that changes the model.

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.
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 1, 2026
Merged via the queue into amd:main with commit 9a525c7 Nov 1, 2026
88 of 89 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/npu-flm-models-9d9a03 branch November 1, 2026 20:37
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Nov 1, 2026
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.
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Nov 2, 2026
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
kovtcharov pushed a commit to kovtcharov/gaia that referenced this pull request Nov 2, 2026
…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>
grtninja pushed a commit to grtninja/gaia that referenced this pull request Nov 5, 2026
…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".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents daemon Daemon supervisor / sidecar control plane devops DevOps/infrastructure changes documentation Documentation changes llm LLM backend changes performance Performance-critical changes tests Test changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants