LEANN Open‑Source Vector Index Cuts 60M‑Chunk RAG Index to 6 GB
UC Berkeley’s LEANN vector index shrinks a 60 M‑chunk Retrieval‑Augmented Generation database from 201 GB to 6 GB while keeping HNSW‑level recall.

UC Berkeley researchers released LEANN, an open‑source vector index that reduces a 60 million‑chunk Retrieval‑Augmented Generation (RAG) database from 201 GB to just 6 GB. The breakthrough matters because it makes large‑scale semantic search feasible on modest hardware while preserving the recall quality of state‑of‑the‑art structures.
What is LEANN and how does it work?
LEANN (Learned Edge‑Adjusted Neural Network) is a vector‑indexing system that stores a pruned graph of neighbor connections rather than the full high‑dimensional vectors. At query time the index recomputes the necessary embeddings on the fly, allowing the stored representation to stay tiny. The authors describe the approach as a hybrid of graph‑based navigation and on‑demand embedding generation, which together enable a dramatic reduction in storage.
How does LEANN compare to existing indexes like HNSW?
According to the MarkTechPost report, LEANN achieves a 90 % recall at the same accuracy level that HNSW (Hierarchical Navigable Small World) typically provides. However, the memory footprint drops from roughly 188 GB for a comparable HNSW index to about 4 GB for LEANN. The trade‑off is latency: LEANN searches take a few seconds, whereas HNSW can return results in milliseconds. For many RAG workloads where batch retrieval is acceptable, the storage savings outweigh the slower response.
What are the practical trade‑offs of using LEANN?
The primary benefit is the drastic compression of vector data, which enables developers to run large RAG indexes on commodity servers or even high‑end laptops. The downside is the increase in query time caused by on‑the‑fly embedding computation and graph traversal. Applications that require real‑time latency (e.g., interactive chat assistants) may need to balance the size gain against the slower response. Moreover, because LEANN recomputes embeddings, any change to the underlying embedding model requires re‑querying the entire index, which can add operational overhead.
How can developers and researchers try LEANN today?
LEANN is released under an open‑source license on GitHub, with installation instructions that rely on standard Python tooling. Users can clone the repository, install the required dependencies, and point the index builder at a collection of text chunks to generate the pruned graph. The authors provide scripts for benchmarking against HNSW, reproducing the 90 % recall figure. For those who prefer not to set up a local environment, the code can be run in a cloud notebook or a container image that ships with the necessary libraries.
What does this mean for AI‑augmented retrieval and RAG pipelines?
RAG systems often need to store millions of document embeddings to support semantic search. LEANN shows that storing the full embedding matrix is not mandatory; a compact graph plus dynamic embedding computation can deliver comparable recall. This opens the door for smaller teams to build enterprise‑scale knowledge bases without incurring massive storage costs. It also encourages research into hybrid indexing strategies that blend static graph structures with adaptive embedding generation.
Grafy relevance – exploring LEANN with Grafy tools
While Grafy does not yet host a dedicated vector‑index module, creators can still explore LEANN through the Grafy Code studio, which lets you run Python notebooks, install packages, and execute the index‑building scripts directly in the browser. For quick experimentation, you could load a sample corpus into Grafy Files (/files) to convert PDFs or text files into chunks, then hand those chunks to the LEANN code in Grafy Code. If you want to ask the index questions without writing code, the Grafy Chat app (/chat) can be paired with a custom bot that forwards queries to a running LEANN instance and returns the nearest‑neighbor results. Finally, the Grafy Reader (/reader) offers a convenient way to open the original research paper and search within it, letting you verify claims or dive deeper into the methodology.
For a step‑by‑step guide, see the Grafy blog post on “AI coding studio runs your code” which explains how to set up a notebook‑style environment inside Grafy. By leveraging these tools, developers can prototype LEANN‑based retrieval pipelines without leaving the Grafy workspace.
Original source: MarkTechPost – Meet LEANN: An Open‑Source Vector Index that Shrinks a 60M‑Chunk RAG Index from 201 GB to 6 GB
Frequently asked questions
How much storage does LEANN actually save compared to a standard HNSW index?
LEANN reduces the memory needed for a 60 M‑chunk RAG index from about 188 GB (typical HNSW) to roughly 4 GB, a factor of more than 40× compression.
Is the slower query time a deal‑breaker for real‑time applications?
It depends on the use case. For batch retrieval or offline knowledge‑base construction, the seconds‑level latency is acceptable. Real‑time chat interfaces may still prefer faster indexes unless the storage constraints are critical.
Can I integrate LEANN with existing vector‑search services like Pinecone or Vespa?
LEANN is a standalone library; it does not plug directly into hosted services. However, you can export its pruned graph and use custom code to serve queries alongside other back‑ends, or wrap it in a micro‑service that sits in front of a larger architecture.


