Applied AI Engineering

Retrieval, Search & Reranking

AI systems often need to find the right context before generating. Keyword search, vector search, metadata filters, hybrid retrieval, and reranking are complementary tools.
  • Keyword search is strong for exact terms
  • Vector search is strong for semantic similarity
  • Metadata filters are not optional
  • Hybrid retrieval increases recall
  • Reranking increases precision
Hybrid retrieval pipeline
Retrieval is a ranking pipeline, not one vector lookup.
Retrieval tools
ToolBest atWeakness
Keyword / BM25Exact terms and rare phrasesMisses paraphrases
Vector searchSemantic similarityCan miss exact identifiers
Metadata filtersBoundaries and freshnessOnly as good as metadata
RerankerPrecision on candidatesAdds latency/cost
Hybrid searchRecall across query typesMore moving parts
Sources
  • OpenAI API DocumentationFile search and retrieval
  • scikit-learn User GuideFeature extraction and nearest neighbors
  • Retrieval-Augmented Generation for Knowledge-Intensive NLP TasksRetrieval-Augmented Generation