core practice · coding problem

Cross-encoder rerank top-k

Retrieve top-5 by BM25, then rerank with scores [0.9,0.2,0.8,0.1,0.7] for query "payment API". Return new order.

The mechanism

Retrieval is recall-oriented and cheap; reranking is precision-oriented and expensive. Retrieve ~100 candidates fast, then run a heavier cross-encoder on just those to reorder the top 10.

Study Reranking

Expected evidence

Doc0, Doc2, Doc4, Doc1, Doc3.

Try this drill in the practice workspace →

Hints when you need them
  • Reranker sees query+doc jointly.
  • Only score the small candidate set.

Watch for these mistakes

  • Reranking the whole corpus instead of a candidate set
  • Adding a reranker without measuring latency budget
  • Not checking that reranking actually beats the retriever on evals

Check the sources

Browse all practice briefs