RAG Reranking Pipeline
Purpose
The Reranking Pipeline describes the sequence of steps between primary search and response generation, where candidates from Vector Search or Hybrid Search are re-ordered by a more precise model.
Diagram
flowchart LR
Q[Query] --> R1[Retrieval: top-100]
R1 --> RR[Reranker: top-10]
RR --> P[Prompt Assembly]
P --> L[LLM]
Parameters
| Parameter | Purpose |
|---|---|
| top_k retrieval | Number of primary search candidates |
| top_n rerank | Number of documents after re-ranking |
| batch size | Batch size for cross-encoder |
| timeout | Time limit for the stage |
Practice
- Primary search is optimized for Recall, re-ranking for Precision.
- The cross-encoder processes the (query, document) pair jointly, which is more accurate than Cosine Similarity, but more expensive.
- Stage delay is accounted for in RAG Latency.
- Quality is evaluated by Retrieval Evaluation Metrics.