You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/review/rag.ts:507/src/review/rag-wire.ts:191-201 rerank RAG retrieval candidates with lexical BM25 only (reranker: "bm25") — already shipped and working (#1124). There is no embedding-based or cross-encoder rerank stage, despite the query's own bge-m3 embedding already being computed at retrieval time (rag.ts:435) and sitting idle after the initial cosine search. Unlike the other items in this batch, this is explicitly NOT a known bottleneck — it's an evaluation, not a guaranteed win.
Requirements
This is a MEASURE-FIRST issue, not a build-first one. Before writing a reranker: establish whether BM25 is actually leaving retrieval quality on the table for real review queries — e.g. sample a set of past reviews, compare BM25-reranked top-K against a cosine-only or cross-encoder-reranked top-K, and see if the ordering meaningfully differs in a way that would change what gets injected into the review prompt.
If the evaluation shows a real gap: the cheapest local option is reranking top-K by cosine similarity against the ALREADY-COMPUTED query embedding (no new model, no new GPU call) before falling back to a dedicated small cross-encoder model — note Ollama has no native /rerank endpoint, so a real cross-encoder would need a sidecar (text-embeddings-inference/infinity), a real infrastructure addition, not a config flip.
A recorded comparison (BM25 vs. cosine-rerank, on a real sample of retrieval queries from this codebase) showing whether reordering meaningfully changes the injected context
A data-backed answer on whether RAG retrieval quality is actually reranker-limited, avoiding speculative infrastructure for an unproven gain — or a concrete, justified improvement if the data says otherwise.
Part of #4325.
Context
src/review/rag.ts:507/src/review/rag-wire.ts:191-201rerank RAG retrieval candidates with lexical BM25 only (reranker: "bm25") — already shipped and working (#1124). There is no embedding-based or cross-encoder rerank stage, despite the query's ownbge-m3embedding already being computed at retrieval time (rag.ts:435) and sitting idle after the initial cosine search. Unlike the other items in this batch, this is explicitly NOT a known bottleneck — it's an evaluation, not a guaranteed win.Requirements
/rerankendpoint, so a real cross-encoder would need a sidecar (text-embeddings-inference/infinity), a real infrastructure addition, not a config flip.Deliverables
Expected outcome
A data-backed answer on whether RAG retrieval quality is actually reranker-limited, avoiding speculative infrastructure for an unproven gain — or a concrete, justified improvement if the data says otherwise.
Effort
S (evaluation) / M (if a build is justified)