feat(eval): per-query kind targeting infra (opt-in; honest negative on NDCG)#4
Merged
Merged
Conversation
…egative result) Adds expected_kind field to every v2-golden.json query (90 tool, 4 skill, 3 subagent, 3 no-kind for adversarial), extends the schema enum, and supports passing q.expected_kind to discover() in the runner — gated behind a new --per-query-kind flag so default behaviour (and A1's CI gate) is unchanged. Result documented in docs/perf/10k-benchmark.md: per-query kind targeting is better than a global kind=tool filter but still drops NDCG@3 on both corpora vs no filter: 434 corpus: 0.7296 → 0.7062 (still trips A1 CI floor) 10k corpus: 0.3139 → 0.2844 Why it drops: A1's relevance maps include cross-kind incidental grades (judges rated some skills/subagents as rel=1 or rel=2 for tool-targeted queries). Any kind filter excludes those hits and loses NDCG points. The infrastructure is correct and ships; making per-query kind targeting a positive remediation requires re-grading the relevance maps with kind-restricted candidate pools — a larger follow-up episode (re-run the judge ensemble with kind-aware candidate sourcing). Default eval:golden behavior unchanged: 434 corpus produces 0.7296, matches v2-baseline-native.json byte-identically. CI gate unaffected. Next remediation candidate (independent of kind): - reliability_score post-filter or third RRF arm (A2 open item #2) - Phase 2 D (Postgres + pgvector) with HNSW + filter-pushdown Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A2's first remediation candidate (per-query kind targeting from v2-golden.json) is implemented as opt-in infrastructure and ships with an honest negative result: per-query targeting is better than the previously-tested global kind filter (PR #3) but still drops NDCG@3 on both corpora vs no filter.
Why it drops (the structural issue)
A1's relevance maps were graded without kind awareness. Some queries' relevance maps include skills/subagents at rel=1 or rel=2 — judges rated cross-kind candidates as "related" or "acceptable". Any kind-restrictive retrieval excludes those incidental hits and loses NDCG points.
What ships
Backward compatibility verified: `npm run eval:golden` against 434 corpus = 0.7296 unchanged. A1 CI gate unaffected.
What this enables for future episodes
The infrastructure is the prerequisite for the real fix path: re-grade the relevance maps with kind-restricted candidate pools so each query's relevance map only contains entries of `expected_kind`. That episode is bigger (re-run the judge ensemble) but with the schema + runner already in place, it's mechanical.
Independent next candidate
`reliability_score` post-filter or third RRF arm (A2 open item #2). Doesn't depend on kind. Addresses the synthetic-tool dilution half of the scale-break.
Test plan
🤖 Generated with Claude Code