
Optimizing BM25 for the Next Generation of Semantic Search Technology
5/5/2025
This post details the technical optimizations made to Exa's BM25 index to reduce memory overhead by over 50%. It introduces a smart candidate selection and dynamic pruning algorithm for query processing. For memory optimization, it describes grouping documents by term frequency, implementing variable-length + delta encoding for document IDs, applying Zstd compression, consolidating postings lists into single buffers, optimizing for singleton tokens, and further consolidating all postings lists into one continuous vector with offset/length pointers. The post also notes a 10% improvement in query latency as a result of these changes.