Retrieval (bi-encoder) embed query và docs độc lập rồi so cosine → nhanh (có thể scale tới hàng triệu docs) nhưng độ chính xác hạn chế vì không "nhìn" query và doc cùng nhau.
Re-ranking (cross-encoder) đưa cặp (query, doc) vào model để chấm điểm relevance trực tiếp → chính xác hơn nhiều nhưng chậm (phải chạy một forward pass cho mỗi cặp, không cache được như embedding).
Giải pháp: two-stage retrieval — bi-encoder retrieve top-K (K=50-100) nhanh → cross-encoder rerank giữ top-N (N=3-10) chất lượng cao. Chi phí chỉ chạy trên K thay vì toàn bộ corpus.
Khi nên dùng:
- Chất lượng top-5 quan trọng (Q&A, customer support).
- Domain phức tạp, nhiều nội dung gần giống.
- Corpus lớn nên retrieval gọi top-K rộng để đảm bảo recall.
Khi KHÔNG cần: corpus nhỏ, latency rất ngặt, hoặc query đơn giản.
Model phổ biến: Cohere Rerank v3, BGE reranker (baai/bge-reranker-large, v2-m3), Jina Reranker, ColBERTv2 (late-interaction, cân bằng tốc độ & chất lượng). Benchmark cải thiện NDCG@10 thường 10-25% so với chỉ dùng bi-encoder.
Retrieval (bi-encoder) embeds query and docs independently then cosine-compares → fast (scales to millions of docs) but limited accuracy since it never sees query and doc together.
Re-ranking (cross-encoder) feeds the (query, doc) pair into the model to score relevance directly → much more accurate but slow (one forward pass per pair, no caching like embeddings).
Solution: two-stage retrieval — fast bi-encoder retrieves top-K (K=50–100) → cross-encoder reranks and keeps top-N (N=3–10). Cost runs only over K, not the full corpus.
When to use:
- Top-5 quality matters (Q&A, customer support).
- Complex domain with many near-duplicates.
- Large corpus where you pull wide top-K for recall.
When NOT to use: small corpus, very tight latency budget, or trivial queries.
Popular models: Cohere Rerank v3, BGE reranker (baai/bge-reranker-large, v2-m3), Jina Reranker, ColBERTv2 (late-interaction, good speed/quality tradeoff). Benchmarks typically show +10–25% NDCG@10 over bi-encoder alone.