Abstract
Retrieval-Augmented Generation (RAG) has become a cornerstone of modern Large Language Model (LLM) applications, yet the storage requirements for high-dimensional vector indices often exceed the size of the raw data itself. This "storage tax" limits the deployment of sophisticated semantic search on resource-constrained devices. We present LEANN (Low-storage Overhead Vector Index), a novel indexing system that reduces storage overhead by up to 50x. By shifting the paradigm from storing embeddings to on-the-fly recomputation and utilizing a high-degree preserving graph pruning strategy, LEANN achieves index sizes as low as 5% of the raw data while maintaining state-of-the-art retrieval accuracy.
Introduction
The standard approach to semantic search involves pre-computing and storing dense vector embeddings for every document chunk in a corpus. For a typical 76 GB text dataset, a state-of-the-art Hierarchical Navigable Small World (HNSW) index requires approximately 188 GB of storage—173 GB for the embeddings and 15 GB for metadata. This footprint is nearly 2.5 times the size of the original data. For developers aiming to implement "Local RAG" on consumer hardware like laptops or mobile phones, this overhead is a prohibitive barrier. While compression techniques like Product Quantization (PQ) exist, they often lead to significant accuracy degradation at the high compression ratios required for local deployment.
The LEANN Architecture
LEANN addresses the storage bottleneck by fundamentally changing how embeddings are handled. Rather than treating embeddings as static data to be stored, LEANN treats them as transient values to be recomputed. The system is built upon four technical pillars:
- On-the-fly Recomputation: Instead of storing full FP32 embeddings, LEANN retains the raw data and re-runs the embedding model (encoder) during the search process.
- Two-Level Search with Hybrid Distance: To maintain performance, LEANN uses a two-level approach. It stores highly compressed, lossy PQ codes (100x smaller than originals) to navigate the proximity graph. Full recomputation is only triggered for the most promising candidates identified during this initial traversal.
- High-Degree Preserving Graph Pruning: Analysis of graph-based indices shows that "hub" nodes—those with high connectivity—are essential for navigation. LEANN prunes the index by keeping these hubs dense while aggressively removing edges from low-degree nodes. This preserves the "highways" of the search graph while drastically reducing metadata size.
- Dynamic Batching: To maximize hardware efficiency, LEANN groups recomputation tasks across multiple search hops, ensuring optimal utilization of GPU or specialized AI accelerators.
Evaluation and Key Results
The authors evaluated LEANN across diverse benchmarks, including the RPJ-Wiki dataset (76 GB, 60 million passages) and various QA tasks such as Natural Questions (NQ) and TriviaQA.
The results demonstrate that LEANN achieves massive storage savings without sacrificing the quality of results. On the 76 GB dataset, LEANN’s index required only 4 GB of storage, compared to 188 GB for HNSW and 270 GB for DiskANN. Despite this reduction, LEANN maintained a downstream accuracy of 25.5% on the NQ benchmark, matching HNSW's performance, while PQ-only methods dropped to 17.9%.
While the search-only latency is higher than traditional indices, the end-to-end RAG latency—which includes the time taken by the LLM to generate a response—increases by only about 10%. In a typical pipeline where an LLM takes 20 seconds to respond, a 2-second search latency is a negligible price for saving over 150 GB of disk space.
Conclusion and Future Work
LEANN demonstrates that the storage-accuracy trade-off in vector search can be bypassed by leveraging the computational power of modern hardware. By using PQ as a "compass" for navigation rather than a "map" for final ranking, and by preserving essential graph hubs, LEANN makes high-performance local RAG a reality. Future research will focus on optimizing the system for multi-hop retrieval tasks and further reducing the latency of the recomputation stage.
Summary updated