Skip to content

fix(eval): apply rerank in the query path + SciFact baseline#235

Merged
jrosskopf merged 1 commit into
mainfrom
fix/eval-apply-rerank
Jun 29, 2026
Merged

fix(eval): apply rerank in the query path + SciFact baseline#235
jrosskopf merged 1 commit into
mainfrom
fix/eval-apply-rerank

Conversation

@jrosskopf

@jrosskopf jrosskopf commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Two things, found by actually running the harness from #234:

  1. Bug fix. 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 metrics to single_pass / two_pass). Fixed with a search_ranked helper that replicates the server's native-lane path: fetch rerank_candidate_pool(k)rerank_hits → truncate to k, used by both the sequential and the concurrent-QPS passes. With rerank disabled it is exactly search(q, k).

  2. Regression guard. The smoke test now passes a deterministic ReverseReranker and asserts the rerank config's ranking differs from single_pass — a no-op rerank fails the test.

  3. Committed baselinedocs/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.

config nDCG@10 recall@10 recall@100 p50 ms QPS
single_pass 0.846 0.921 0.993 146 12.5
two_pass 0.847 0.924 0.993 174 10.0
rerank 0.671 0.802 0.993 15104 0.2
two_pass_rerank 0.672 0.803 0.993 15030 0.2

Findings:

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].
  • Full local gate green: fmt, clippy --workspace --all-targets -D warnings (+ -p escurel-eval --features candle,rerank), cargo test --workspace --all-targets, cargo build --workspace --release.

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

…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>
@jrosskopf jrosskopf merged commit 43c8c97 into main Jun 29, 2026
1 check passed
@jrosskopf jrosskopf deleted the fix/eval-apply-rerank branch June 29, 2026 10:25
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