fix(search): anchor rare-identifier symbols into pre-rerank pool (P2) - #54
Merged
Merged
Conversation
… root cause) P2 gold (engine.py) sat at BM25#126/FTS#74 vs [:limit] cut; O1 boosted the wrong file (rarest token != gold symbol). Anchors resolve exact-symbol chunks via single-token FTS (def-first, df<=120, docs/data excluded, caps 2+3+MAX) — P2 rank 1 live, holdout gate 15/15 PASS.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
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.
Mechanism
P2 query (\hybrid_search_async reciprocal_rank_fusion FTS5 BM25) never had its gold chunk (\src/core/search/engine.py) in the 5-chunk pre-rerank pool, so no pool-stage boost (O1 included) could rescue it. New: _anchor_identifier_chunks_async\ resolves exact-symbol chunks for rare identifier tokens DIRECTLY (single-token FTS fetch, ~70ms warm) and appends them pre-rerank, before O1. Definition chunks outrank caller chunks sharing the symbol; docs/data never anchor; caps 2/token + 3 total + MAX_RERANKER_INPUT; any failure degrades to the unanchored pool.
Root cause (numbers, fresh-process + discarded warm-up + void-checked)
rf_results[:limit]\ with
aw_limit=min(limit*2,30)\ (engine.py).
eciprocal_rank_fusion\ (df=4, strictly rarest) while gold's symbol is \hybrid_search_async\ (df=100) — no exact match; live O1 fired on \scoring.py\ instead.
Design choice: (b) tier-winner anchoring for identifier tokens
Latency cost (reranker_ms vs pool; llama.cpp BGE-M3 live)
~0.4s/chunk => reaching gold at depth 126 would cost ~50s. Anchors cost ~0.14s. P2 wall with fix: ~2.6-3.0s (unchanged profile).
Holdout (\scripts/p2_holdout_gate.py, fresh process, GATE PASS)
Contract: P2==1, H2/N1 unboosted, DOC never doc-boosted, no void, no degraded rows. H-ranks without expectations are informational (gate asserts no unexpected boost, not ranks).
Red-team (doc-guard + H2 lessons applied)
Caveats
DO NOT MERGE — awaiting review.