<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Prashanth Gummala on Medium]]></title>
        <description><![CDATA[Stories by Prashanth Gummala on Medium]]></description>
        <link>https://medium.com/@prashanthgummala?source=rss-1e4e54cce81d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WznuceXwtiryU3bIwpHfgw.jpeg</url>
            <title>Stories by Prashanth Gummala on Medium</title>
            <link>https://medium.com/@prashanthgummala?source=rss-1e4e54cce81d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 05:07:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prashanthgummala/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LEANN: The Tiny Vector Index That Makes Personal AI Real]]></title>
            <link>https://medium.com/@prashanthgummala/leann-the-tiny-vector-index-that-makes-personal-ai-real-a05e1d4fb819?source=rss-1e4e54cce81d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a05e1d4fb819</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Prashanth Gummala]]></dc:creator>
            <pubDate>Wed, 12 Nov 2025 12:21:03 GMT</pubDate>
            <atom:updated>2025-11-12T12:24:55.814Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of us working on AI-powered tools (RAG agents, personal assistants, document search) hit the same pain point: <strong>vector indexes are huge</strong>. As the authors of LEANN note, indexing 100 GB of raw text can require 150–700 GB of storage using traditional approaches.</p><p>That means: laptops choke, edge deployments fail, privacy suffers (you have to off-load data to cloud).</p><p>What if you could shrink that index to under <strong>5%</strong> of raw data size, and still get good recall and latency? That’s exactly what LEANN offers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3DSog9FpXMKKA6v-f-4Zww.png" /><figcaption>Image by — Prashanth</figcaption></figure><h3>What is LEANN?</h3><p>LEANN (Low-Storage Vector Index) is a novel vector-search index designed for storage-constrained devices: laptops, local servers, even edge. Developed by researchers at UC Berkeley (and collaborators) it uses two key ideas:</p><ol><li><strong>On-the-fly embedding recomputation</strong>: Instead of storing full embeddings for every document/chunk, LEANN recomputes embeddings at query-time for only the needed subset.</li></ol><p><strong>2. High-degree-preserving graph pruning</strong>: When building the graph index (based on HNSW), LEANN prunes many links/edges while preserving important “hub” nodes, thus massively reducing metadata storage.<br> Combined, these allow LEANN to index large corpora while using very little storage — e.g., indexing 60 million text chunks in just ~6 GB instead of ~200 GB in a standard HNSW build.</p><h3>HOW IT WORKS</h3><h3>1. Index Build</h3><ul><li>Split your document into several chunks.</li><li>Create an embedding for each chunk using an embedding model.</li><li>Compress each embedding into a smaller code to save space.</li><li>Build a graph that connects similar chunks together.</li><li>Prune the graph to remove extra links and keep only the main hub nodes.</li><li>Store the graph structure and the compressed codes instead of all full embeddings.</li></ul><h3>2. Query Time</h3><ul><li>When a user asks a question like “How do I define a function in Python?”, create an embedding for that query.</li><li>Start the search from a hub node in the pruned graph.</li><li>Compare the query with nearby nodes using the small compressed codes to get quick approximate matches.</li><li>Keep the most relevant chunks in a short list for detailed checking.</li></ul><h3>3. Exact Distance &amp; Re-Computation</h3><ul><li>For the top candidate chunks, re-compute or load their full embeddings.</li><li>Calculate the exact distance between the query and those full embeddings.</li><li>Rank the chunks based on how close they are to the query.</li></ul><h3>4. Return Response</h3><ul><li>Pick the top matching chunks or paragraphs.</li><li>Show those chunks as the final search result to the user.</li><li>The result feels fast and accurate while using very little storage.</li></ul><h3>Pseudo Example</h3><p>Imagine you have a PDF called <strong>“Python Notes”</strong> with 1,000 pages.<br> You want to make it searchable using AI.</p><p>In a normal vector database, the system creates and stores an embedding for <strong>every page</strong> — this takes a lot of space.</p><p>In <strong>LEANN</strong>, it works differently:</p><ul><li>It first makes embeddings for all pages to understand their meaning.</li><li>Then it <strong>compresses</strong> those embeddings into small codes to save space.</li><li>It <strong>builds a graph</strong> that connects related pages — like “functions” linked to “parameters” or “loops”.</li><li>It <strong>removes extra links</strong>, keeping only the main hub pages that connect many topics.</li></ul><p>When you ask a question like <em>“How do I define a function in Python?”</em>,</p><ul><li>LEANN embeds your question,</li><li>Uses the <strong>small codes</strong> to find a few likely pages,</li><li>Then only for those pages, it <strong>recomputes full embeddings</strong> to check them precisely,</li><li>Finally, it returns the most relevant answer from your PDF.</li></ul><p>So you get <strong>almost the same accuracy</strong> as a normal system — but with <strong>very little storage</strong> and <strong>fast results</strong>.</p><h3>Short Usage Code Snippet</h3><p><strong>— code snippet</strong> showing how to use LEANN via its Python API to build, prune, and query an index</p><pre># 1) Import the builder and searcher<br>from leann import LeannBuilder, LeannSearcher<br><br># 2) Build the index from your document chunks<br>builder = LeannBuilder(backend_name=&quot;hnsw&quot;)<br># Add text chunks (you might loop over pages or paragraphs)<br>builder.add_text(&quot;This is a chunk about defining functions in Python.&quot;)<br>builder.add_text(&quot;Another chunk about loops and list comprehensions in Python.&quot;)<br># Build the index and save it<br>INDEX_PATH = &quot;my_python_notes.leann&quot;<br>builder.build_index(INDEX_PATH)<br><br># 3) Query the index<br>searcher = LeannSearcher(INDEX_PATH)<br>results = searcher.search(&quot;How do I define a function in Python?&quot;, top_k=3)<br><br># 4) Print results<br>for rank, res in enumerate(results, start=1):<br>    print(f&quot;{rank}. (score={res.score:.3f}) → {res.content[:200]}&quot;)</pre><h3>RAG System Using LEANN</h3><p>After exploring LEANN, I built a small <strong>RAG (Retrieval-Augmented Generation) system</strong> using it as the vector index.<br> I connected <strong>LEANN</strong> with <strong>Streamlit</strong> to make a simple web interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mIdsorCH-m-pTdrdEl9iqw.gif" /><figcaption>GIF by — prashanth</figcaption></figure><h3>Benefits</h3><ul><li>Dramatically smaller storage footprint: LEANN can reduce index size to under 5% of the raw data size.</li><li>Enables on-device or local deployments: Because it uses much less storage, it becomes feasible to run semantic search on laptops, edge devices or private data stores.</li><li>Maintains high retrieval quality: Despite the storage savings, LEANN achieves competitive recall (e.g., ~90% top-3) and reasonable latency.</li><li>Privacy and data control: Storing less embedding data and enabling local indexing means you can keep more of your data on-device and reduce cloud dependence.</li></ul><h3>⚠Limitations</h3><ul><li>Peak storage and compute during index build: While the runtime footprint is small, building the index (embedding all chunks, constructing the graph) may still require significant resources.</li><li>Query latency overhead: Because embeddings are recomputed on-the-fly for some nodes, query times may be higher than systems that pre-store all embeddings, especially on weaker hardware.</li><li>Accuracy may vary depending on domain or dataset: In some benchmarks with domain mismatch (e.g., graduate-level questions), its gains are less pronounced.</li><li>Graph metadata still occupies space: Though much reduced, the graph structure (nodes + edges) still uses non-trivial storage relative to extremely constrained devices</li></ul><h3>References</h3><p>I’ve used the following research sources while preparing this article on LEANN (Low-Storage Vector Index):</p><ul><li><a href="https://arxiv.org/pdf/2506.08276"><strong>Wang, Yichuan et al.</strong> (2025). <em>LEANN: A Low-Storage Vector Index.</em></a></li><li><a href="https://github.com/yichuan-w/LEANN"><strong>Official LEANN GitHub Repository</strong> by Yichuan Wang and team (UC Berkeley &amp; Collaborators)</a></li></ul><p><strong><em>Thanks for your time !</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a05e1d4fb819" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>