feat(eval): tool-prompt cost & TTFT baseline harness (#1448 Part 0)#1546
Conversation
Review: tool-prompt cost & TTFT baseline harness (#1448 Part 0)SummaryApprove with minor suggestions — this is a clean, well-scoped, measure-only addition that changes no loader/agent/selection logic, and the one thing worth knowing is that the whole thing is correctly built to run model-free in CI. The harness defers all heavy imports, stubs missing optional deps, and isolates the global tool registry behind a One caveat on verification: I could not execute the suite in this environment (no Issues Found🟢 Unbounded 🟢 Model-free test lives under 🟢 Tight, deliberate coupling to Strengths
VerdictApprove with suggestions. No blocking issues. The |
|
Latest commit addresses all three review suggestions:
The review above still showing the original three items is expected, not stale CI: per On the 4 failing checks — they're Lemonade-server startup timeouts on the self-hosted runners, not caused by this PR:
All four fail at the Lemonade-server-start step, before any test executes — the smoke test (which runs no GAIA tests, just starts the server and loads a model) timing out shows the runner pool can't start Lemonade at the moment. None of these jobs import the new module; they only ran because the PR touches |
|
Confirmed — all three review items landed in Fixes verified:
On the failing jobs: agreed they're environmental — this PR's three-file diff (a dependency cap, a docstring, a test relocation) can't affect server startup, and none of those jobs import the new module; they only ran because These need a maintainer to re-run once the runner pool is healthy — I can't re-trigger checks. @kovtcharov-amd, could you kick off a re-run? I'll hold off on a fresh full review unless you'd like one ( |
|
Thank you for working on this! Could you kindly share the baseline results from the tool? |
|
Thanks @kovtcharov-amd — I've posted the full baseline results from the tool as a comment on #1448 (comment). Quick summary of what's there:
Full reasoning, the premise correction, recommended |
|
Re-confirming the 5 red checks are infra, not this PR. I just merged the latest Every job ran the same prefix successfully (checkout → Python setup → Install Lemonade Server ✓ → Verify GAIA Installation ✓), then failed at the first step that starts Lemonade and loads a model — before any test executed (test steps show
The clincher: the Lemonade Server Smoke Test itself failed. That job only starts Lemonade, loads a model, and pings it — it imports none of this PR's code. The failures also span two runners (sjlab-stx-1 and sjlab-stx-3), so it's pool-wide. These jobs only triggered because Could a maintainer re-run these once the runners are healthy? If they keep timing out at Lemonade start, the runners likely have stale |
|
Should be fixed now, rerunning CI/CD. |
|
Looks like one of the workflows is still failing. I'm going to complete this PR since it's unrelated to the failure. |
Summary
Adds a measure-only harness that quantifies the doc agent's tool-prompt cost (both render paths), its per-tool slope, and the first-turn prompt-prefill TTFT — establishing the #1448 Part 0 baseline the dynamic tool-loader (Part 1, #1449) must beat. No loader/agent/selection logic is changed.
Why
The tool-loader effort (#688) needs a real baseline, and #1448's original "~12K tokens / ~400-per-tool" premise didn't match the actual renderer. This PR measures the truth on the
docagent: the native tool schemas (tools=, the Gemma default) cost 5,128 tokens and add ~13–16 s of first-turn prefill TTFT vs a 5-tool set — a clear GO for the loader, with a concrete reduction target. Without these numbers Part 1 has nothing to prove a reduction against. (Full go/no-go reasoning is posted as a comment on #1448.)Linked issue
Closes #1448
Changes
src/gaia/eval/tool_cost.py— deterministic, model-free measurement of tool-prompt cost on both render paths (_format_tools_for_promptvs_build_openai_tool_schemas), per-tool size distribution, cost slope (tokens per added tool), and a "fixed loaded subset stays flat as the registry grows" demonstration. Also: a scorecard TTFT parser, and a live model-resident, no-RAG prompt-prefill TTFT micro-bench (--live-ttft) that isolates the cost the loader actually changes. CLI:python -m gaia.eval.tool_cost.tests/unit/test_tool_loader_token_budget.py— pins the baseline (37-tool doc set, native ≫ text), asserts the slope is linear and the loaded subset is flat, and covers the TTFT parser against a committed scorecard fixture. 7 tests, fully model-free.setup.py— addtiktokento theeval/devextras (tokenizer proxy for the cost harness).Test plan
No Lemonade backend required for the first three — the harness builds a ChatAgent skeleton with mocked backends, so it never calls a model:
python util/lint.py --all→ all checks passpython -m pytest tests/unit/test_tool_loader_token_budget.py -xvs→ 7 passed (model-free)python -m gaia.eval.tool_cost --profile doc→ prints both-path cost, per-tool distribution, slope, and fixed-subset tables (model-free)Backend required — only this one:
python -m gaia.eval.tool_cost --profile doc --live-ttft→ full-vs-subset prompt-prefill TTFT. Needs Gemma-4-E4B already loaded/resident in Lemonade (no RAG; the bench never loads or evicts models — it fails loudly if the model isn't resident).Checklist
Closes #1448).python util/lint.py --all,pytest tests/).