Skip to content

fix(skills): measure auto-load on a held-out half and set defaults that fire - #8510

Merged
kovtcharov-amd merged 8 commits into
amd:mainfrom
kovtcharov:kalin/autoload-calibration
Nov 19, 2026
Merged

kovtcharov-amd merged 8 commits into
amd:mainfrom
kovtcharov:kalin/autoload-calibration

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Skill auto-load shipped in #5442 with a floor that was never measured on the current request set, so it almost never fired, and its calibration test could not run against GAIA's own Lemonade (401, no API key). This re-measures it and picks defaults that fire, while auto-load stays off by default.

  • Held-out calibration. The labelled set grows to 243 requests; the 234 for skills on disk (62 needing no skill) are split by hash into a tuning half and a held-out half. Defaults are chosen on the tuning half only and checked on the held-out half.
  • Better matching. Skills are matched by description under EmbeddingGemma's document prompt and the request under its classification prompt. Suggestion floor 0.35; auto-load floor 0.40 with a 0.03 lead.
  • Calibration bar. Questions about a skill's topic ("what is RSS?") score as high as real requests, so the test no longer requires zero loads on no-skill requests; it allows at most a fifth of them. A wrong load costs context only, and auto-load remains opt-in. The spec, CHANGELOG and release notes all say off by default.
  • Paired skills. A skill named in another's pairs_with is no longer auto-loaded with it unless it leads on its own score; otherwise it is named as "Also available".
  • The calibration embedder now sends the Lemonade key and fails with an actionable 401/403 message.

Eval

Suggestions are on by default, so the per-turn suggestion line changes for every user. The RC eval should watch gaia_skills_tasks, gaia_skills_lifecycle, gaia_skills_capture and gaia_tool_selection. Auto-load itself is off by default, so no lane exercises it.

Test plan

  • python -m pytest tests/unit/test_skill_suggester.py
  • cd hub/agents/gaia/python && python -m pytest tests/test_skill_suggestions.py
  • GAIA_SKILL_SUGGEST_CALIBRATE=1 LEMONADE_BASE_URL=<server> python -m pytest tests/unit/test_skill_suggester.py -k calibration -s

The opt-in skill calibration posted to /embeddings with no Authorization
header, so against GAIA's own key-protected Lemonade every call was a 401
and the defaults could not be measured. It now resolves the key the way
the client does, reading the real GAIA home the suite otherwise hides, and
names the missing key when the server still refuses.
The 90-request set had about three requests per hub skill, 21 negatives and
no long task prompt, too few to split into a tuning and a held-out half.
Adds three more requests per skill, 20 long task prompts (500-2,200
characters, some with a pasted table, log or transcript) and 41 negatives:
small talk, general and coding questions, and questions about pasted text.
Two requests that shared wording with an eval scenario or task were
reworded.
…at fire

Auto-load at the shipped 0.55 floor loaded a skill on about one request in
ten and the calibration test failed on main. Skills are now embedded by
description alone under EmbeddingGemma's document prompt and the request
under its classification prompt, the auto-load floor is 0.40 and the
suggestion floor 0.35.

The labelled requests are split in two by a hash; prompts and floors were
chosen on the tuning half. Held-out half (118 requests, 29 needing no
skill), auto-load: precision 0.93, recall 0.58, 62 loads, 4 wrong, all 4 on
questions about a skill's topic. Before: precision 0.91, recall 0.11, 12
loads. The calibration tests hold the defaults to a stated bar on the
held-out half and print both halves.
@github-actions github-actions Bot added documentation Documentation changes tests Test changes agents labels Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This re-tunes skill matching: requests and skill descriptions are now embedded with EmbeddingGemma's own prompts, the labelled set is split into a tuning half and a held-out half, and the defaults (suggest at 0.35, auto-load at 0.40) are chosen on the tuning half and checked on the held-out half. The method is sound and the code change is small. Auto-load stays opt-in and only runs on the embedder it was calibrated for, so nothing breaks.

Two things to tidy before merge:

  • Suggestions are on by default, so every user's turns change. The new prompts and the higher suggestion floor change which skill hint the model sees on most turns, and no agent turn was run. Name the eval categories to watch on the next RC in the description.
  • The request count disagrees. The description says 230 labelled requests. The spec page says 224, and its held-out and tuning numbers also add up to 224. Say which is right, or say what the other 6 are.

Real-world evidence

N/A: no evidence bundle was produced for this PR. It changes internal matching defaults, tests, a fixture and a spec page, with no new CLI, API or UI surface. The verdict rests on static review. I could not run the unit tests here (pytest isn't installed on this runner), and the real-embedder calibration needs a Lemonade server, so the precision and recall figures are the author's own measurement.

🔍 Technical details

Issues

🟡 Suggestions change for everyone, but no eval is planned (src/gaia/agents/base/skill_suggester.py:96, :132-133)
skill_suggestions defaults to on (hub/agents/gaia/python/gaia_agent/agent.py:305). This PR changes three things that decide the per-turn suggestion line the model reads:

  • DEFAULT_SUGGEST_THRESHOLD goes from 0.30 to 0.35.
  • The text embedded for a skill drops the name and gains DOC_PROMPT.
  • The query gains QUERY_PROMPT.

On the held-out half, 11 of 29 negatives still get a suggestion. This isn't on CLAUDE.md's required-eval list word for word, but it changes what the model sees on every turn. Add the categories to watch (likely the skill and gaia_* lanes) to the PR so the next RC covers them.

🟢 224 vs 230 (docs/spec/agent-skills.mdx:669)
The fixture has 230 cases. The spec says "224 invented requests", and 106 + 118 = 224. The difference is probably _present_cases dropping cases for skills that aren't on disk. Either say that, or use one number in the PR body and the spec.

🟢 Prompts are EmbeddingGemma-specific, but suggestions run on any embedder (skill_suggester.py:132)
Auto-load is correctly gated to DEFAULT_EMBEDDING_MODEL (agent.py:774), but suggestions still run on any other embedder, which now receives title: none | text: / task: classification | query: . That was already uncalibrated before this PR, so it's not a regression. It's worth one line in the module docstring so nobody assumes the prefixes are generic.

Checked, no finding

  • Config defaults read the constants (agent.py:305, :314), so the new values reach the agent with no second literal to update.
  • Doc drift: the only remaining 0.55 mentions are the spec's "earlier defaults" sentence and a past CHANGELOG entry. Both are fine.
  • The suggester's vector cache keys on (name, doc), so the new doc text re-embeds once and isn't confused with skill_doc_text vectors used for body selection.
  • The calibration embedder now sends the Lemonade key and fails with an actionable 401/403 message instead of a bare raise_for_status.

Strengths

  • A hash-fixed tuning/held-out split, with a test pinning which half two known requests land in. Defaults are no longer graded on the data they were picked from.
  • The calibration tests now enforce a precision, recall and negative-rate bar instead of "zero loads on negatives", which the old defaults met only by almost never loading (recall 0.11).
  • test_the_request_is_embedded_under_the_query_prompt checks the exact text sent to the embedder, not just that it was called.

office-docs landed on main with requests in the tuning half only, so the
split test failed: a skill with no held-out request is never measured.
Adds seven office-docs and six slide-decks requests, which puts each skill
in both halves, and restates the measured numbers for 28 hub skills.
Held-out auto-load at the defaults: precision 0.92, recall 0.59, 65 loads,
5 wrong, 4 of 29 negatives; the bar is unchanged and still met.
…core

A skill that pairs with the best match loaded with it as soon as it reached
the floor. In real runs one such companion loaded on five requests and none
of its tools was called: it only added its body and tool schemas to every
step. On the tuning half 1 of the 7 companions loaded was a labelled skill.

A companion now loads only when it reaches the floor and leads every
remaining skill by the lead itself. Otherwise it stays a suggestion, and
after an auto-load the suggestion line is an offer ("Also available: X"),
not an instruction to load. Two skills per turn at most, as before.

Measured with embeddinggemma-300m at 0.40 and 0.03: tuning half precision
0.91, recall 0.72, 68 loads, 6 wrong (was 0.90, 0.73, 74, 7); held-out half
0.93, 0.59, 60 loads, 4 wrong (was 0.92, 0.59, 65, 5).
…numbers

The spec and the changelog still said a paired skill loads at the floor, and
the changelog still named the 0.55 floor this branch replaced with 0.40.
@kovtcharov-amd
kovtcharov-amd merged commit 387d255 into amd:main Nov 19, 2026
53 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants