Skip to content

feat: local cross-encoder reranker in retrieval hot path #353

Closed

Description

@hurttlocker

Context

From SuperLocalMemory audit (docs/research/superlocalmemory-audit.md). SLM's own ablations show cross-encoder reranking is the single biggest contributor to their 74.8% LoCoMo score. Cortex currently has no reranker after fusion.

What

Add a local cross-encoder reranker (BAAI/bge-reranker-v2-m3) that runs after hybrid/RRF fusion, before returning final results. This re-scores the top candidates using a cross-attention model that sees both query and document together — fundamentally better than embedding similarity which encodes them independently.

Expected Impact

+4 to +10 F1 on LoCoMo conv-30 (currently 15.77% via cortex ask)

Implementation Notes

  • Run after fusion, before top-k selection
  • Score top ~20-30 candidates, return reranked top-k
  • Must work fully local (ONNX or similar runtime)
  • Add --rerank flag with auto-detection
  • Graceful fallback when reranker model not available

Effort

L (1-2 weeks)

References

  • SLM audit: docs/research/superlocalmemory-audit.md
  • SLM reranker impl: src/superlocalmemory/retrieval/reranker.py
  • Model: BAAI/bge-reranker-v2-m3

Activity

  1. added
    memory
    on Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    memory

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions