Overview
LEANN is an open-source vector index from UC Berkeley's Sky Computing Lab, published as arXiv 2506.08276 and awarded best paper at MLSys 2026. The code is MIT licensed and the GitHub repository has passed thirteen thousand stars. The problem it targets is concrete: RAG over millions of documents usually means computing every embedding up front and storing them, which pushes indices into the hundreds of gigabytes and off most personal devices.
The approach removes the stored embeddings. The index keeps only a pruned nearest-neighbour graph, and during a query it walks that graph and recomputes embeddings for the nodes it actually visits. Graph construction applies high-degree preserving pruning, keeping hub nodes and dropping redundant edges so traversal paths do not degrade, which is how it saves 97 percent of storage without losing recall.
The published comparison covers five corpora. The 2.1 million document DPR set drops from 3.8GB to 324MB, the 60 million chunk Wikipedia index from 201GB to 6GB, 400,000 chats from 1.8GB to 64MB, 780,000 emails from 2.4GB to 79MB, and 38,000 browser records from 130MB to 6.4MB. Savings land between 91 and 97 percent, which is what makes a full index viable on a laptop.
Key Features
- Graph on disk, embeddings on demand: Index size scales with the number of edges, not vector dimensions. Embeddings are computed at query time only for visited nodes, so no full copy of the vectors is persisted.
- High-degree preserving pruning: Graph construction keeps highly connected hub nodes and removes redundant edges, preventing traversal from dead-ending after pruning. It is the mechanism that holds recall while storage drops.
- Two backends: HNSW is the default and saves the most storage by recomputing everything. DiskANN compresses with product quantization and reranks live, aimed at latency-sensitive work and billion-scale corpora with a slightly larger storage budget.
- Two-level search and dynamic batching: Traversal prioritises promising nodes and candidate embeddings are batched to use the GPU efficiently, which is what keeps on-demand recomputation from making queries slow.
- Data stays local: The retrieval path does not send documents or embeddings to an external service, so personal corpora can be indexed and queried entirely on your own machine.
Use Cases
- A personal knowledge base on a laptop, indexing mail, notes and browsing history without filling the disk.
- Retrieval over a private codebase where indexing and querying stay inside the network.
- RAG on edge devices and offline environments, trading storage for recomputation.
- Reproducing the research, with evaluation scripts that run all five corpora end to end.
- Billion-scale corpora where latency matters, switching to DiskANN for compressed search plus live reranking.
Pros
- The Wikipedia index over 60 million chunks falls from 201GB to 6GB, a 97 percent saving.
- Savings across the five corpora run between 91 and 97 percent with recall preserved.
- Best paper at MLSys 2026, with a paper and reproducible evaluation scripts behind the numbers.
- MIT licensed, thirteen thousand stars, active community.
- HNSW and DiskANN cover both the storage-first and latency-first cases.
- The whole pipeline works offline, so data never leaves the machine.
Pricing
MIT licensed and free, with self-hosting carrying only hardware and compute cost. There is no hosted tier to price; the library installs from pip and ships evaluation scripts, and the tradeoff is that recomputation spends GPU or CPU time at query time, so machines with heavy query volume need headroom. Managed services built on it bill according to their own platforms.
Summary
LEANN makes one plain trade: swap stored vectors for query-time computation. That works when compute is cheaper than storage and query volume is not high enough to make recomputation the bottleneck, both of which hold for personal devices and internal knowledge bases. The MLSys best paper award and published scripts make it more reproducible than most index projects. For full-corpus RAG on a laptop without buying more disk, it is the most direct option available now.
Version History
- LEANN open sourced: a 60M-chunk RAG index falls from 201 GB to 6 GB (2026-10-28): UC Berkeley's Sky Computing Lab open sourced LEANN, arXiv 2506.08276, best paper at MLSys 2026, MIT licensed. The index persists only a pruned nearest-neighbour graph and recomputes embeddings on demand during queries, cutting the 60 million chunk Wikipedia index from 201GB to 6GB and saving 91 to 97 percent across five corpora. HNSW is the default backend with optional DiskANN for billion-scale, low-latency work, supported by two-level search and dynamic batching.