Repository navigation
feat: add local cross-encoder reranker - #355
Merged
Merged
Conversation
hurttlocker
force-pushed
the
feat/cross-encoder-reranker
branch
from
March 23, 2026 14:55
6a6926c to
710f365
Compare
hurttlocker
marked this pull request as ready for review
March 23, 2026 14:58
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.
Closes #353
What changed
internal/rerank/with:internal/search/search.goafter hybrid / RRF fusion and before final top-k return--rerank[=auto|on|off]forsearch,answer, andaskcortex rerank-setupto download the local model into~/.cortex/models/rerank/docs/research/reranker-benchmark-2026-03-23.mdWhy this change exists
Issue #353 identified local cross-encoder reranking as the highest-upside retrieval improvement from the SuperLocalMemory audit. This PR lands the infrastructure needed to test that thesis inside Cortex’s real retrieval hot path instead of a wrapper harness.
Touched surfaces
cmd/cortex/main.gointernal/search/search.gointernal/search/search_test.gointernal/rerank/go.modgo.sumdocs/research/reranker-benchmark-2026-03-23.mdTests run
Benchmark / eval truth
This PR changes both product behavior and benchmark interpretation.
Measured on the
conv-3081-questioncortex askpath with the same populated LoCoMo DB:ask --rerank off:10.53%F1ask --rerank on:1.14%F1ask --rerank off:12.48%F1ask --rerank on:11.93%F1So the evidence-window fix materially recovered the regression, but the reranked path is still slightly below the same-run no-rerank baseline and significantly slower.
The benchmark note also records one more finding:
onnx-community/bge-reranker-v2-m3-ONNX:int8looked directionally better on a spot check, but was too slow for the current process-per-query CLI architecture to benchmark fully in a reasonable timeRisk note
baseint8 reranker is still slightly worse than no reranker on the full sliceaskpath even after the evidence-window fixmainproduced an empty DB in this environment, so the final benchmark used the existing populated LoCoMo DB as allowed by the issue promptDocs
docs/research/reranker-benchmark-2026-03-23.mdRecommendation
Keep this PR as draft until we either: