Repository navigation
feat(atlas-core): deterministic offline retrieval evaluation harness (#5741) - #6262
Conversation
…5741) First bounded slice of #5741: the eval harness its test plan builds before any SPLADE adoption decision. atlas_core::eval reads the versioned atlas-eval/v1 format (queries with class + dev/test split, graded qrels, saved rankings from any signal - dense, BM25, SPLADE, fused) and computes nDCG@10, Recall@100, Recall@1000, MRR@10 per query, per class, and overall; per-query top-100 runs are preserved in the report for recomputation. Reports are deterministic (sorted signals/queries/classes, round6 floats, byte-identical across runs and input permutations). Split discipline is enforced in code: select_best_signal refuses held-out test reports so parameter selection cannot tune on test qrels. atlas-eval bin runner scores a split fully offline (no model, no database). fixtures/eval-smoke.json is a hand-written SMOKE fixture only - labeled in-file and in eval/README.md as never evidence for adoption. Tests: hand-computed golden oracles for every metric, split isolation, test-split selection refusal, format validation, missing-run rule, a 2000-case seeded invariant sweep (metrics in [0,1], recall monotone in k, ideal ranking nDCG=1), and fixture determinism. cargo test -p atlas-core: all suites pass.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95c1a261fb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| recall100: round6(raw.recall100), | ||
| recall1000: round6(raw.recall1000), | ||
| mrr10: round6(raw.mrr10), | ||
| top100: ranking.iter().take(100).cloned().collect(), |
There was a problem hiding this comment.
Preserve the evidence needed to recompute report metrics
When the report is retained without the original input, the promised report-only metric recomputation is impossible: top100 discards ranks 101–1000 needed for Recall@1000, and PerQuery contains no document-level judgments needed to recompute nDCG or identify relevant hits. For example, the existing recall-boundary test has a relevant document at rank 120 that would disappear from this report. Preserve the top-1000 ranking and applicable qrels, or equivalent sufficient scoring evidence, so saved evaluation reports can actually be audited independently.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6af6ef0: PerQuery now preserves the top-1000 ranking (top1000, was top-100) plus the query's judged grades (grades map), so nDCG@10, Recall@100/1000 and MRR@10 can all be recomputed from the report alone. New test report_preserves_evidence_for_recomputation keeps a relevant doc at rank 120, asserts it survives in the record, and recomputes every metric from the preserved record alone against the reported values. — task 10582, lane code-u
| .iter() | ||
| .map(|doc| { | ||
| let grade = grades.get(doc).copied().unwrap_or(0); | ||
| (2f64.powi(grade as i32) - 1.0).max(0.0) |
There was a problem hiding this comment.
Reject grades that overflow the gain calculation
For an accepted relevance grade of 1024, 2f64.powi produces infinity, so even a perfect ranking computes nDCG as inf / inf = NaN. This propagates into the aggregates and serializes as JSON null rather than a numeric score. The format currently permits arbitrary u32 grades and validation imposes no upper bound; grades above i32::MAX also wrap to negative exponents in this cast. Validate a supported grade range or use a numerically stable gain normalization before scoring.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6af6ef0: validation now rejects qrel grades above MAX_GRADE (30, exported as atlas_core::MAX_GRADE). Gains are 2^grade - 1 in f64, so the cap keeps every gain finite and the grade-as-i32 exponent cast exact, with wide headroom over real graded schemes (typically 0-4). The grade-1024 case is covered in validation_rejects_format_violations. — task 10582, lane code-u
… qrel grades (Codex PR #6262 findings) - PerQuery now preserves the top-1000 ranking (was top-100, which dropped ranks 101-1000 needed for Recall@1000) plus the query judged grades, so every reported metric can be recomputed from the report alone; new test recomputes from the preserved record. - Validation rejects qrel grades above MAX_GRADE (30): an unbounded u32 grade could overflow the 2^grade gain to infinity (grade 1024) and turn nDCG into NaN serialized as JSON null.
Implements the first bounded slice of #5741 (queue task 10582): the deterministic offline evaluation harness the issue's test plan builds before any SPLADE adoption decision.
What lands
atlas_core::eval— reads the versionedatlas-eval/v1format (queries with class + dev/test split, graded qrels, saved rankings from any signal: dense, FTS5/BM25, SPLADE, fused) and computes nDCG@10, Recall@100, Recall@1000, MRR@10 per query, per query class, and overall. Per-query top-100 runs are preserved in the report so every number can be recomputed from the report alone.round6Python-parity rounding — same input serializes byte-identically across runs and across input-order permutations (tested).select_best_signalrefuses a held-out test-split report, so parameter selection cannot silently tune on test qrels.atlas-evalrunner bin:cargo run -p atlas-core --bin atlas-eval -- <eval.json> <dev|test>— fully offline, no model, no database, no search execution.fixtures/eval-smoke.json— a hand-written smoke fixture only, labeled in the file and ineval/README.mdas synthetic: never evaluation evidence, never an adoption claim. The real held-out set is Atlas search: SPLADE investigation — third retrieval signal, eval harness, query-adaptive weighting #5741 test-plan step 1 and does not exist yet; this harness is what will score it.eval/README.mddocuments the format, metrics, split discipline, and scope limits.Explicitly out of scope (per the task packet): SPLADE encoder/postings, production query-path changes, query-adaptive weighting (#5773), query-time parameter surface (#5774), collecting/judging the real held-out set, any adoption decision.
Tests (every test names its oracle, per the testing doctrine)
cargo test -p atlas-coreon the laptop: all suites pass (eval::tests 11/11);cargo fmtclean; runner output byte-identical across repeated runs.— queue worker, lane code-d, task 10582
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.