Hybrid Search and Re-ranking
Combine keyword and semantic search (hybrid search) and use re-ranking models to prioritize the most relevant documents.
Beyond Basic Retrieval
When building advanced Retrieval Augmented Generation (RAG) systems, simply finding documents isn't enough. We need to find the most relevant documents efficiently.
Traditional keyword or semantic searches, while powerful, each have limitations. To overcome these, we can combine their strengths.
Keyword Search: Specificity
Keyword search (also known as sparse retrieval, e.g., using BM25 or TF-IDF) is excellent for finding exact matches and specific terms.
- Strengths: Great for precise queries, proper nouns, and when you know the exact wording.
- Weaknesses: Struggles with synonyms, different phrasing, or understanding conceptual meaning.
For example, searching 'Python list append' works well, but 'add element to Python array' might miss results.
All lessons in this course
- Multi-Query Retrieval Strategies
- Contextual Compression with LLMs
- Hybrid Search and Re-ranking
- Parent Document and Sentence-Window Retrieval