Skip to content

hellerve-project-based-learning/reranker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reranker

A tiny reranker built on cross-encoding. It:

  • loads .md posts (title, summary, body)
  • retrieves top-N candidates with a bi-encoder (fast)
  • reorders them with a cross-encoder (precise)
  • prints results + debug timings
  • includes a micro-eval (Recall@K) and a latency sweep

Read more about it on my blog.

Install

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Quick start

  1. Put some posts in content/.

  2. Run a search:

python -m reranker.cli search \
  --root content \
  --query "i’m searching for my missing piece" \
  --num-candidates 48 \
  --num-results 8 \
  --columns-to-rerank title summary body \
  --columns id title url

Usage

usage: reranker [-h] {search,eval,sweep} ...

Tiny reranker

positional arguments:
  {search,eval,sweep}
    search             Run retrieval + rerank
    eval               Evaluate with Recall@K using qrels.json
    sweep              Latency sweep for different candidate counts

options:
  -h, --help           show this help message and exit

Have fun!

About

A tiny RAG reranker for learning purposes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages