Skip to content

feat(atlas-core): deterministic offline retrieval evaluation harness (#5741) - #6262

Merged
dezren39 merged 2 commits into
mainfrom
queue/10582-5741-atlas-eval-harness
Nov 5, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/10582-5741-atlas-eval-harness

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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 versioned atlas-eval/v1 format (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.
  • Deterministic reports: signals/queries/classes processed in sorted order, floats through the crate's round6 Python-parity rounding — same input serializes byte-identically across runs and across input-order permutations (tested).
  • Split discipline in code, not just docs: select_best_signal refuses a held-out test-split report, so parameter selection cannot silently tune on test qrels.
  • atlas-eval runner 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 in eval/README.md as 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.md documents 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)

  • Hand-computed goldens for each metric: nDCG 0.796708 from gains/discounts worked in the comment, MRR 1/3 and 0, Recall across the 100-boundary (1/2 @100, 1 @1000 on a 150-doc ranking), overall + per-class means.
  • 2,000-case seeded invariant sweep: all metrics in [0, 1], recall monotone in k, ideal ordering always scores nDCG 1.
  • Split isolation, test-split selection refusal, format validation (bad version, duplicate ranking docs, unknown-qrel query, duplicate qrels), missing-run-scores-empty, fixture determinism + dev selection.
  • cargo test -p atlas-core on the laptop: all suites pass (eval::tests 11/11); cargo fmt clean; runner output byte-identical across repeated runs.

— queue worker, lane code-d, task 10582


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…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.
@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 15:29
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0296bd24-c11f-4124-9a45-00cba7f617a5
Commits

Reviewing files that changed from the base of the PR and between 2a67620 and 6af6ef0.

Files selected for processing: 5

  • pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs
  • pkgs/atlas-search/crates/atlas-core/src/eval.rs
  • pkgs/atlas-search/crates/atlas-core/src/lib.rs
  • pkgs/atlas-search/eval/README.md
  • pkgs/atlas-search/fixtures/eval-smoke.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T17:03:48.058558Z 6af6ef0 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant