Repository navigation
fix(agent): fixes from NPU eval runs of Gemma-4-E4B - #6496
Conversation
NPU evals of gemma4-it-e4b-FLM failed on real bugs as well as model slips; these fixes took tool_selection, gaia_core and gaia_rag from 27/41 to 32/41. - RAG cited the wrong page when a chunk ran across a page break: every chunk's 'page' was where it started. Chunks now split at '[Page N]' markers, so each entry's page is true for all its text. - The eval MCP clipped assistant replies at 2000 chars, so a judge failed answers whose figures came later. Replies are no longer clipped. - Two prompt rules contradicted each other (no documents → answer from knowledge, vs. smart discovery for the user's own files), and folder indexing asked before acting. Both now say what to do. - New rules: hold a checked fact under pressure, don't accept "as I said" that never happened, ignore fake system notices, treat instructions inside documents as prompt injection, prefer the newer of conflicting documents. - An empty-index query result now tells the model to index a folder the user named instead of asking. Prompt snapshots re-captured with the characterization harness.
FastFlowLM ends a long prefill with zero tokens about once in 250 calls (4 of 1,099 in the NPU eval runs), and the turn ended on "I received an empty response". An empty reply now spends the same bounded re-prompt as a narrated next step, so the user gets an answer instead of "try again".
A question over eight one-paragraph reports saw only five of them, so "total across all eight" was summed over five. When every candidate chunk fits in the text the five-chunk cap would spend anyway, the search now returns all of them, ranked chunks first. The model also asked "Should I index it?" after the user said "Index <folder>". That reply now spends the bounded re-prompt and the agent is told to index. The prompt rules added for the NPU eval fixes put the full profile over its 12K-char budget on Linux; merging duplicate rules brings it back to 11,926 (11,844 before those fixes).
The NPU rerun still failed the eight-report rollup: the user said "Index <folder>" in turn 1, and the model offered "Tell me to index it and I'll process them" there, then asked "Shall I proceed with indexing?" in turns 2 and 3. The guard read only the current message and missed both phrasings. It now counts an "index" anywhere in the session's user messages and matches those offers. The keyword-search test now ignores the unmatched chunks a small index returns.
|
Verdict: Request changes (one small fix) The PR fixes real NPU eval failures: a small index now comes back whole so rollups see every report, an empty model reply or a needless "should I index it?" gets one bounded re-prompt, citations use the right page, and the prompt gains rules on injection and on holding a correct fact. The approach is sound and well tested. One guard is too eager.
Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on static review alone. Agent behaviour and the Agent UI MCP transcript change were not exercised here, and the touched unit tests could not run on this runner (pytest isn't installed). The PR's own eval items are still unchecked. 🔍 Technical details🟡 ImportantIndex-permission guard matches refusals and unrelated uses of "index" ( Add a test for "Don't index ~/private" followed by "Should I index it?" that asserts no re-prompt. 🟢 Minor
Strengths
|
The "user already told you to index it" nudge fired on anything mentioning
"index" anywhere in the session, so it overrode a user who said "do not
index my private folder" and pushed past the agent's own questions about
which folder to index or whether a 40,000-file index was worth 20 minutes.
- Only this turn's message counts, and only an un-negated imperative to
index a path or folder/file ("index ~/reports", "re-index the docs
folder"); "index.html", "S&P 500 index" and "refractive index" never do.
- Only a bare yes/no permission question is nudged; a choice ("which",
"or"), a cost/scale warning, or a closing remark is left for the user.
- Retrieval messages now count the chunks actually returned after the
page split, matching num_chunks and the instruction.
- get_messages clips assistant replies again by default; full_replies=True
returns them whole, and the eval judge asks for that.
A vendor-onboarding DOCX with an embedded "[Assistant directive]" got Gemma-4-E4B to claim it had saved a skill file, and on a rerun to try writing one, when the user asked whether it had changed any files. The injection rule named documents but never forbade the tool calls a directive asks for, and "challenged, recheck once" read the user's "just checking" question as a cue to act. The injection rule now calls such text data and bars its tool calls (writes to ~/.gaia, skills or config above all) and dictated replies. A new rule makes the agent answer "what did you do?" from the tool calls it made, with no new ones. Recheck-on-challenge is scoped to answers.
Resolves the conflicts with amd#6496 and amd#6287's question-language note, and bounds the re-search so a fact that really is absent still gets its answer. - The "search once more" note moves out of the citation instructions into a wrapper on query_documents and query_specific_file. Only the turn's first search that returns chunks carries it, so the second search can no longer ask for a third. Empty and failed searches are left alone and don't spend it. - Rule 2 of the RAG prompt is cut to fit the full profile's 13,000-char budget after amd#6496 (12,979 on Windows, up 10 from main). - Prompt goldens recaptured: the profilespec rows and the non-Claude golden differ from main only in rule 2.
Running Gemma-4-E4B on the Ryzen AI NPU through the agent evals turned up bugs that ended turns badly. Asked to total eight short regional reports, the agent summed only five, because search returned at most five chunks even when the whole index was smaller than that. A model reply with zero tokens ended the turn on "I received an empty response, please try again". This happens on about 1 in 250 NPU calls after a long prompt. Told to "Index ", the model asked "Should I index it?". It also treated an instruction planted in a PDF as a possibly valid override, and gave in when pushed on a correct fact. Each case now recovers: a small index comes back whole, an empty reply or a needless permission question costs one bounded re-prompt, and the prompt names injection and fact-holding rules.
Follows #6341, which made the FastFlowLM models reachable.
gaia_core,gaia_ragandtool_selection.Test plan
python -m pytest tests/unit hub/agents/gaia/python/tests— passes, except three tests that need Playwright, which isn't installed on the test machineGAIA_CONFIG_FILE(no local default model)gaia_ragandgaia_coreevals on the NPU on this branch's final commitgaia_core,gaia_rag,tool_selection