How AI Is Built
How AI Is Built
Nicolay Gerold
Nov 15, 2024 · 54 min

#031 BM25 As The Workhorse Of Search; Vectors Are Its Visionary Cousin

MP3
Ever wondered why vector search isn't always the best path for information retrieval?Join us as we dive deep into BM25 and its unmatched efficiency in our latest podcast episode with David Tippett from GitHub.Discover how BM25 transforms search efficiency, even at GitHub's immense scale.BM25, short for Best Match 25, use term frequency (TF) and inverse document frequency (IDF) to score document-query matches. It addresses limitations in TF-IDF, such as term saturation and document length normalization.Search Is About User ExpectationsSearch isn't just about relevance but aligning with what users expect: GitHub users, for example, have diverse use cases—finding security vulnerabilities, exploring codebases, or managing repositories. Each requires a different prioritization of fields, boosting strategies, and possibly even distinct search workflows.Key Insight: Search is deeply contextual and use-case driven. Understanding your users' intent and tailoring search behavior to their expectations matters more than chasing state-of-the-art technology.The Challenge of Vector Search at ScaleVector search systems require in-memory storage of vectorized data, making them costly for datasets with billions of documents (e.g., GitHub’s 100 billion documents).IVF and HNSW offer trade-offs: IVF: Reduces memory requirements by bucketing vectors but risks losing relevance due to bucket misclassification.HNSW: Offers high relevance but demands high memory, making it impractical for massive datasets.Architectural Insight: When considering vector search, focus on niche applications or subdomains with manageable dataset sizes or use hybrid approaches combining BM25 with sparse/dense vectors.Vector Search vs. BM25: A Trade-off of Precision vs. CostVector search is more precise and effective for semantic similarity, but its operational costs and memory requirements make it prohibitive for massive datasets like GitHub’s corpus of over 100 billion documents.BM25’s scaling challenges (e.g., reliance on disk IOPS) are manageable compared to the memory-bound nature of vector search engines like HNSW and IVF.Key Insight: BM25’s scalability allows for broader adoption, while vector search is still a niche solution requiring high specialization and infrastructure.David Tippett:LinkedInPodcast (For the Sake of Search)X (Twitter)Tippybits.comBlueskyNicolay Gerold:⁠LinkedIn⁠⁠X (Twitter)Bluesky

This podcast uses Anchor (from Spotify) for stats, tracking, and dynamic audio. What this means Timestamps may be slightly off because ads are inserted dynamically. Episodes play from the podcast's own servers, unmodified. Not affiliated with Podbay.