Repository navigation
feat(eval): retrieval-centric capability-discovery eval harness (ir.eval) - #18
Merged
Merged
Conversation
…val) Add `ir.eval` — a deterministic, offline scoring layer for "does retrieval surface the right capability?". Retrieval-centric by design: ir's corpora are documents (skills/packages/reports) joined on artifact_id, not a typed function-calling registry, so the eval scores retrieval of the right artifact, not argument-dict matching. Reuse over reinvention: metric math (recall@k / NDCG@k / MRR / MAP) and the BEIR driver come from `ef.evaluation`; ir adapts a corpus to ef's retriever contract (query -> [artifact_id]) and reads back a RetrievalEvalReport. Surface: - DiscoveryCase (+ save/load JSONL with optional corpus-version meta header) - as_doc_retriever / to_qrels / retrieval_report (pure-ef path) - evaluate_discovery -> DiscoveryReport (metrics + failure taxonomy + optional score-threshold abstention proxy; records ranking mode and flags a hybrid->dense fallback when vd is absent) - distractor_robustness_curve (seeded needle-in-a-haystack; x-axis capped to the corpus so it never over-claims N) + distractor_curve_from_cases - validate_cases (drift detection: gold ids that left the corpus) - CLI: `ir eval <corpus> <cases.jsonl> [--mode] [--k]` Scoring-harness-first: no LLM, no network (dense path is numpy-only; lexical/hybrid use the already-declared vd dep). Case generation (back-translation + name-masking) is deferred to a follow-up. 24 hermetic tests (light embedder, disjoint-vocab corpus for exact assertions; a confusable corpus to prove the distractor curve actually declines) + a demo fixture. Full suite green; ruff clean. Refs #12, #1.
This was referenced Jun 6, 2026
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.
What
Adds
ir.eval— a deterministic, offline scoring layer for the question the rest ofirraises: does retrieval actually surface the right capability? This is PR 1 of the eval harness (#12): the scoring side. Case generation is deferred to a follow-up.Design stance — retrieval-centric, reuse
efThe
ir_03research doc targets a typed@commandregistry (deepdiff/AST/BFCL on argument dicts).ir's corpora are documents (skills/packages/reports) joined onartifact_id, with no argument signatures — so the eval that fits is retrieval of the right artifact.ef.evaluationalready provides every retrieval metric (recall_at_k,ndcg_at_k,precision_at_k, MRR, MAP) plus the BEIR driverevaluate_retrieval(native multi-gold viaQrels) andRetrievalEvalReport.ir.evalimports these — the bridge is a ~3-line adapter (query → [artifact_id], whichefconsumes as bare doc-ids).Surface
DiscoveryCaseartifact_ids (empty = abstention);save_cases/load_casesJSONL with an optional corpus-version__meta__headeras_doc_retriever/to_qrelsircorpus toef's retriever contractretrieval_reportefpath — recall@k / NDCG@k / MRR / MAP. A/B dense vs hybridevaluate_discovery→DiscoveryReporthit_rank_1/surfaced_low_rank/retrieval_miss) + optional score-threshold abstention proxy. Records the rankingmodeand flags a silent hybrid→dense fallback whenvdis absentdistractor_robustness_curve(+_from_cases)len(scope)so it never over-claimsNvalidate_casesir eval <corpus> <cases.jsonl> [--mode] [--k](warns on drift)Scope / non-goals
lexical/hybriduse the already-declaredvddep.Testing & review
rufflint + format clean.ef-contract fidelity · design · test gaps); all confirmed findings are addressed in this PR — notably the all-abstention NaN-vs-Nonecontract, the distractor-curve x-axis capping, degenerate-trial collapse, and the reproducibility flag forvd-absent hybrid runs.Note for maintainers
ir.evalduplicatesef.evaluation._RETRIEVAL_METRICS(a name→fn map) because that registry is private. A small improvement opportunity inef: expose a publicRETRIEVAL_METRICSregistry (orget_metric_fn(name)) soircan import it instead of mirroring it (the mirror is comment-pinned for now).Refs #12, #1.