fix(eval): apply rerank in the query path + SciFact baseline#235
Merged
Conversation
…baseline
The harness called `Indexer::search` directly, which does NOT run the
reranker — the rerank stage lives in the server's `tool_search`
(`rerank_hits` after `search`). So the `rerank`/`two_pass_rerank` configs
were a silent no-op (byte-identical to single_pass/two_pass).
Fix: a `search_ranked` helper that replicates the server's native-lane
path — fetch `rerank_candidate_pool(k)` candidates, apply `rerank_hits`,
truncate to `k` — used by both the sequential and the concurrent-QPS
passes. With rerank disabled it is exactly `search(q, k)`, so single_pass
/ two_pass are unchanged.
Regression guard: the smoke test now passes a deterministic
`ReverseReranker` and asserts the `rerank` config's ranking DIFFERS from
single_pass (nDCG drops under reversal) — a no-op rerank fails it.
Baseline: committed `docs/eval/baseline-scifact.{md,json}` — a 1000-doc
qrels-preserving SciFact subsample (CPU candle embedding can't do the
full 5183 in reasonable time) with bge-base-en-v1.5 + bge-reranker-base.
Findings: two_pass is quality-neutral with a small latency cost (as
designed at this corpus size); rerank REGRESSES nDCG@10 (0.846 → 0.671)
and latency (~15 s/query on CPU) because it scores the 200-char snippet,
not the full abstract — the report names the two concrete levers (fuller
passages; GPU / smaller candidate pool).
Co-Authored-By: Claude Opus 4.8 <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
Two things, found by actually running the harness from #234:
Bug fix. The harness called
Indexer::searchdirectly, which does not run the reranker — the rerank stage lives in the server'stool_search(rerank_hitsaftersearch). So thererank/two_pass_rerankconfigs were a silent no-op (byte-identical metrics to single_pass / two_pass). Fixed with asearch_rankedhelper that replicates the server's native-lane path: fetchrerank_candidate_pool(k)→rerank_hits→ truncate tok, used by both the sequential and the concurrent-QPS passes. With rerank disabled it is exactlysearch(q, k).Regression guard. The smoke test now passes a deterministic
ReverseRerankerand asserts thererankconfig's ranking differs fromsingle_pass— a no-op rerank fails the test.Committed baseline —
docs/eval/baseline-scifact.{md,json}.Baseline (BEIR SciFact, 1000-doc qrels-preserving subsample)
bge-base-en-v1.5(768-d BERT) +bge-reranker-base, CPU, 300 test queries.Findings:
rerank_passageusesSearchHit.snippet). Two concrete levers named in the report: feed fuller passages to the reranker; rerank only on GPU and/or with a much smaller candidate pool.The eval did its job — turned "the reranker is wired in" into a measured, falsifiable result.
(1k subsample because candle CPU BERT embedding is ~0.5 docs/s; the harness runs the full corpus unchanged on a BLAS/GPU build. Absolute numbers are indicative; the per-config deltas are the signal.)
Test plan
cargo test -p escurel-eval— metric units + the strengthened smoke test (real DuckDB + HashEmbedder +ReverseReranker, asserting rerank is applied). No model download, no#[ignore].--workspace --all-targets -D warnings(+-p escurel-eval --features candle,rerank),cargo test --workspace --all-targets,cargo build --workspace --release.🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.