← Latest papers
🤖 AI

Hierarchical BM25: Lexical Search at Billion-Document Scale

Hierarchical BM25 enables interactive, billion-scale lexical search by replacing a memory-intensive flat index with a two-tier architecture that uses a small, resident coarse index to select relevant document groups, achieving fixed memory and latency bounds while preserving exact scoring for the retrieved subset.

Original authors: Umesh Deshpande, Swaminathan Sundararaman

Published 2026-08-04
📖 4 min read☕ Coffee break read

Original authors: Umesh Deshpande, Swaminathan Sundararaman

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to find a specific fact in a library that contains one billion books. In the world of computer science, this is the challenge of "lexical search"—finding documents based on exact word matches, like searching for the phrase "hierarchical BM25" rather than just the general idea of it. For decades, computers have been getting better at this, but there's a catch: to search a billion books instantly, you usually need to keep a massive map of every single word in every single book in your computer's main memory (RAM). This map is so huge—about 400 gigabytes—that it's like trying to carry the entire library in your backpack while you run. If you don't have that much memory, you have to run back and forth to the shelves (the hard drive) for every question, which takes seconds. In a world where we expect answers in a blink, waiting four to twelve seconds is like watching paint dry; it breaks the experience. This paper tackles that exact problem: how do we search a billion documents instantly without needing a supercomputer's memory?

The authors propose a clever new way to search called Hierarchical BM25. Instead of trying to memorize the whole library at once, they suggest a two-step strategy that mimics how a human librarian would help you. First, they organize the one billion documents into about 1,000 distinct "aisles" or groups based on their topics. They build a tiny, super-fast index of just these aisles that fits easily into memory (about 4.4 GB). When you ask a question, the computer doesn't scan every book; it first checks this small index to figure out which 40 aisles are most likely to have the answer. It then dives only into those specific aisles to find the exact books.

The magic here is a trade-off. The authors admit that by skipping the other 960 aisles, they might miss the absolute perfect answer once in a while. They call this giving up "rank safety"—the guarantee that you get the exact top 10 results every single time. However, they argue that in modern search systems, getting the 10th-best result instead of the 11th-best rarely matters because a second computer (a "reranker") will sort them out anyway. What does matter is speed. By making this trade, they achieve something previously impossible: they can search a billion documents in about 300 milliseconds (less than a third of a second) using a tiny amount of memory.

In their tests, this new method was 4.7 to 5.6 times faster than the old, standard way of searching, even when the old method used multiple processors to help out. While the old method struggled to handle more than 3 questions per second, this new system could handle up to 32 questions per second when the "aisles" were already warm and ready. The authors also discovered a subtle bug in how different groups of books were scored against each other and fixed it, ensuring that when they did search, the math was perfectly accurate.

However, the authors are very careful not to call this a perfect solution. They explicitly state that this method is an approximation, not a guarantee. They measured how well it worked on a smaller test of 500,000 documents and found that by checking just 5% to 10% of the groups, they recovered about 83% to 92% of the "quality" of a full search. They suggest this will likely hold up at the billion-document scale, but they haven't proven it yet on a natural, messy real-world dataset. They also note that their method works best for long, complex questions (16 to 32 words), which are common in modern AI systems, whereas older methods were designed for short, simple web searches.

In short, this paper suggests that if you are willing to accept a tiny chance of missing the absolute best answer, you can build a search engine for a billion documents that is fast, cheap, and fits in a standard computer's memory. It's a practical engineering win that prioritizes speed and efficiency over mathematical perfection, acknowledging that in the real world, a fast "good enough" answer is often better than a slow "perfect" one.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →