<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>on-device on Abrit Pal Singh</title><link>https://abritpal.github.io/tags/on-device/</link><description>Recent content in on-device on Abrit Pal Singh</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 31 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://abritpal.github.io/tags/on-device/index.xml" rel="self" type="application/rss+xml"/><item><title>Agentic RAG in Edge Applications</title><link>https://abritpal.github.io/posts/agentic-rag-in-edge-applications/</link><pubDate>Fri, 31 Jul 2026 00:00:00 +0000</pubDate><guid>https://abritpal.github.io/posts/agentic-rag-in-edge-applications/</guid><description>On-Device LLMs, RAG, and the Tools to Make It All Happen</description><content:encoded><![CDATA[<p><em>This post is based on a talk I gave at</em> <a href="https://www.youtube.com/watch?v=HezNjx_4PTA"><em>Techceleration</em></a> <em>in October 2025.</em></p>
<hr>
<p>Building RAG pipelines in the cloud has become almost routine. Spin up a vector database, wire it to an LLM API, and you’ve a working system by lunch. For most applications, that’s the right call, the cloud gives you the biggest models, effortless scaling, and a mature tooling ecosystem.</p>
<p>But it is not always the best choice. Some applications can’t send data off-device, can’t assume a network connection, or can’t absorb the per-call cost at scale. And so often, a region outage is a pointed reminder that “someone else’s computer” is a dependency.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-olKGReq_1QYuD-KzLG1Ddw_hu_f91f43cc23a8d8ed.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-olKGReq_1QYuD-KzLG1Ddw_hu_b22b4e83d0a147dd.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-olKGReq_1QYuD-KzLG1Ddw_hu_e25763e2312b8007.jpeg" width="1440">
</picture><p><em>A familiar feeling for anyone who’s lived through a cloud region outage though, to be clear, edge isn’t a fix for outages so much as a different set of tradeoffs.</em></p>
<p>That’s what I set out to explore in my talk and in this write-up: not whether <strong>edge-RAG</strong> should <strong>replace cloud</strong> RAG, but what it actually takes to run agentic RAG on-device: local models, local retrieval, local tool execution and how to tell when that’s the right architecture for the job.</p>
<p>Here’s a walkthrough of the key ideas:</p>
<h2 id="why-edge-rag">Why Edge-RAG?</h2>
<p>The instinct to keep everything in the cloud is understandable. Cloud infrastructure is mature, scaling is someone else’s problem, and you get access to the most powerful models available. But there are four compelling reasons to consider moving your RAG pipeline to the edge.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-Dmi4qm1wxfVfvrwdJBSqUQ_hu_69897d03ce23038f.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-Dmi4qm1wxfVfvrwdJBSqUQ_hu_3e236a364753745b.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-Dmi4qm1wxfVfvrwdJBSqUQ_hu_d758996a8245bc2e.png" width="1440">
</picture><p><em>The four pillars driving the case for edge-RAG. (Source: Author)</em></p>
<p><strong>Zero cloud transmission</strong> is the first and perhaps most obvious benefit. When your data never leaves the device, you eliminate transmission costs entirely. For applications processing sensitive documents at scale, this adds up fast.</p>
<p><strong>Built-in compliance</strong> follows naturally. Regulations like HIPAA and GDPR impose strict requirements on where data can travel and be processed. An on-device pipeline is compliant by design, there’s no data in transit to worry about.</p>
<p><strong>Enhanced security</strong> is the third benefit. When inference and retrieval happen on-device, you eliminate whole class of network-based attacks: there are no API keys to leak, no man-in-the-middle interception of inference calls, and no sensitive data sitting in someone else’s cloud storage waiting to be breached.</p>
<p>And finally, <strong>offline capability</strong>. In many real-world scenarios such as field operations, areas with unreliable connectivity, or simply situations where you can’t depend on a stable internet connection. An edge-RAG system continues to work without missing a beat.</p>
<h2 id="the-tradeoffs">The Tradeoffs</h2>
<p>Edge-RAG has its own limitations. Moving your pipeline on-device means working within real hardware constraints: limited RAM, weaker GPUs (or none at all), and smaller models that can’t match the reasoning depth of their cloud counterparts. You’re trading raw capability for privacy, latency, and independence. The key is knowing when that trade makes sense and when it doesn’t, which is why the decision framework later in this post matters. Edge-RAG works best when you design <em>for</em> the constraints rather than trying to work around them.</p>
<p>In edge deployments, I’ve hit a hard wall trying to accelerate weight tensors on the Hexagon HTP NPU, the DSP’s 32-bit address space caps you at ~2GB per session, so larger models silently fall back to CPU. The QNN HTP backend also rejects most quantized formats, accepting only F16/F32. These are the kind of constraints that you only discover after you’ve already committed to a hardware platform.</p>
<h2 id="understanding-edge-rag">Understanding Edge-RAG</h2>
<p>When I say “edge-RAG,” I’m really describing a spectrum with two main approaches.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-rKTv198gAyv7I9_OLVdpLw_hu_82a161db1f964fe6.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-rKTv198gAyv7I9_OLVdpLw_hu_f9786191d8ac49d6.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-rKTv198gAyv7I9_OLVdpLw_hu_5f0699b532557b38.jpeg" width="1440">
</picture><p><em>Two approaches to edge-RAG: fully local vs. hybrid. (Source: Author)</em></p>
<p>The <strong>fully local</strong> approach puts everything on-device: the language model, the vector store, the embedding model, the agentic reasoning layer, all of it runs locally. This gives you maximum privacy and offline capability, but you’re constrained by the device’s compute and memory.</p>
<p>The <strong>hybrid</strong> approach keeps the agent and retrieval logic on-device while selectively offloading certain components to the cloud. Maybe your embedding model runs locally but complex reasoning tasks get routed to a cloud LLM when connectivity is available. This gives you a middle ground.</p>
<h2 id="the-components">The Components</h2>
<p>A complete edge-RAG system has several moving parts.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-7bm8AQKQxVKColrNfcs-YA_hu_3bc27b6438d1162.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-7bm8AQKQxVKColrNfcs-YA_hu_ec18ea83ae709939.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-7bm8AQKQxVKColrNfcs-YA_hu_b29c6540e37b8caf.jpeg" width="1440">
</picture><p><em>The building blocks of an edge-RAG system. (Source: Author)</em></p>
<p>There’s the <strong>language model</strong> itself (typically a small language model, or SLM), a <strong>local vector store</strong> for your embeddings, an <strong>agentic layer</strong> that handles reasoning and decision-making, and a <strong>local tool and system integration layer</strong> that lets the agent interact with device capabilities: things like opening apps, toggling settings, or querying local APIs.</p>
<p>The agentic layer decides what to do. It selects which tool to call, plans multi-step sequences (e.g., “first open Maps, then search for this address, then start navigation”) and handles error recovery when a step fails. This system can reason, plan and also act. Without it, you just have a retrieval pipeline.</p>
<p>Supporting these are a <strong>context manager / memory buffer</strong> for maintaining conversation state, a <strong>runtime and optimization</strong> layer to squeeze maximum performance out of limited hardware, and optionally a <strong>cloud-fallback layer</strong> for the hybrid approach.</p>
<h2 id="the-flow">The Flow</h2>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-zA-Kh4KUo7ctHPtL2D8UPg_hu_8b9f3e97cf1ae5ab.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-zA-Kh4KUo7ctHPtL2D8UPg_hu_840b3e17ccc34207.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-zA-Kh4KUo7ctHPtL2D8UPg_hu_ffa2b4b6ac325ea3.jpeg" width="1440">
</picture><p><em>Simplified flow: from user query to response, all on-device. (Source: Author)</em></p>
<p>The simplified pipeline works like this:</p>
<ul>
<li>a user query comes in, gets embeddings locally, which is used to retrieve relevant context from the local vector store</li>
<li>the retrieved context and the query feed into the agent’s reasoning step, where the on-device LLM decides what to do. It might answer directly or call a local tool, or plan a sequence of actions.</li>
<li>finally, the response is generated and local memory is updated.</li>
</ul>
<p><em>This is a conceptual flow, not an implementation blueprint. I’ve collapsed some steps for readability (a full system like MobileRAG, for instance, separates planning/app-selection from action execution, and adds loops this linear view doesn’t show).</em></p>
<p><strong>How the Demo Works: MobileRAG in Action</strong></p>
<p>To make this concrete, I demo-ed a <a href="https://arxiv.org/abs/2509.03891">MobileRAG</a> implementation running on Android. MobileRAG is a good example of what edge-agentic-RAG looks like in practice: it uses three types of retrieval working together:</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-SmFQm1_8gUiSiVOB99aiuA_hu_c450db32de3401b7.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-SmFQm1_8gUiSiVOB99aiuA_hu_b24a45e6931fc358.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="572" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-SmFQm1_8gUiSiVOB99aiuA_hu_4ed52aa95d0c9b3c.png" width="1440">
</picture><p><em>MobileRAG architecture: MemRAG, InterRAG, and LocalRAG working together to execute a multi-step task on-device. (Source: <a href="https://arxiv.org/abs/2509.03891">Loo et al., “MobileRAG: Enhancing Mobile Agent with Retrieval-Augmented Generation”</a>)</em></p>
<p><strong>MemRAG</strong> stores the agent’s past trajectories such as:</p>
<ul>
<li>what apps it opened,</li>
<li>what actions it took, and</li>
<li>what worked.</li>
<li>When a new task comes in, the agent checks this memory first.</li>
</ul>
<p>Think of it as muscle memory: if the agent has done something similar before, it recalls the playbook rather than figuring it out from scratch.</p>
<p><strong>InterRAG</strong> handles the cases where the agent doesn’t know something like which app to use. In the diagram, the user asks to add “The Boys” Season 3 to a watchlist. The agent doesn’t know which streaming platform carries the show, so InterRAG searches the web to figure out it’s a Prime Video exclusive. This is the “<em>thinking</em>” step.</p>
<p><strong>LocalRAG</strong> is the on-device knowledge base of installed apps and their capabilities.</p>
<ul>
<li>The agent checks LocalRAG to see if Prime Video is already installed, and if not, plans to download it</li>
<li>After completing the task, LocalRAG updates itself automatically, so next time, the agent already knows the path.</li>
</ul>
<p>These three components chain together into a seamless multi-step execution:</p>
<blockquote>
  <p>Identify the right app -&gt; Open it -&gt; Navigate the UI -&gt; Complete the task -&gt; Update local knowledge.</p>

</blockquote><p>My demonstration used two of them, <em>MemRAG and LocalRAG</em>.</p>
<ul>
<li>MemRAG pulls the recorded steps for a known task, and</li>
<li>LocalRAG identifies which installed app handles it and launches it, after which the task runs to completion.</li>
</ul>
<p>Simple tasks like “search IIT Madras on Google Maps” and “turn on Bluetooth” were processed entirely on-device, with the agentic layer translating natural language intent into system level actions.</p>
<video poster="/posts/agentic-rag-in-edge-applications/assets/1-a3ajPlLbzdkThr4fXGSGFg-poster.jpg" width="1280" height="720" autoplay loop muted playsinline controls preload="metadata"
       aria-label="Live demo: natural language commands driving device actions through on-device agentic RAG" >
  <source src="/posts/agentic-rag-in-edge-applications/assets/1-a3ajPlLbzdkThr4fXGSGFg.mp4" type="video/mp4">
</video><p><em>Live demo: natural language commands driving device actions through on-device agentic RAG. (Source: Author)</em></p>
<h2 id="building-edge-rag-tools-and-resources">Building Edge-RAG: Tools and Resources</h2>
<p>If you’re looking to actually build this, the ecosystem has matured quite a bit.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-1CrBo-r2JBMisJMPlK0XMQ_hu_4bba3448e29be360.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-1CrBo-r2JBMisJMPlK0XMQ_hu_691516613ec00eb8.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-1CrBo-r2JBMisJMPlK0XMQ_hu_1e07d1e15b6e0d4e.jpeg" width="1440">
</picture><p><em>Key tools and frameworks for building edge-RAG systems (Source: Author)</em></p>
<ul>
<li>For the <strong>backend layer</strong>, Google’s <a href="https://developers.google.com/edge/mediapipe/framework"><strong>MediaPipe Framework</strong></a> provides a solid foundation for building on-device ML pipelines with pre-built components for common tasks.</li>
<li>For <strong>runtime and inference, LiteRT Community</strong> (previously TFLite) remains a strong choice.</li>
<li>For <strong>testing</strong>, the <a href="https://developers.google.com/edge/ai-edge-portal"><strong>AI Edge Portal</strong></a> gives you a platform to benchmark and validate your edge models, and</li>
<li>if you want an <strong>open-source end-to-end</strong> solution, <a href="https://iree.dev/"><strong>IREE.dev</strong></a> is worth exploring. It’s a compiler and runtime stack that can target everything from mobile GPUs to embedded accelerators.</li>
</ul>
<h2 id="when-to-usewhat">When to Use What</h2>
<p>Not every scenario calls for edge-RAG. Here’s a practical decision framework:</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-tzhBJo-9he3ktkp44f4X2w_hu_7dc39c8a83787341.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-tzhBJo-9he3ktkp44f4X2w_hu_134f2043ceb62f9e.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-tzhBJo-9he3ktkp44f4X2w_hu_fbc4599ff7a1b378.jpeg" width="1440">
</picture><p><em>Matching your use case to the right RAG architecture. (Source: Author)</em></p>
<ul>
<li>If you need <em>privacy with</em> <strong><em>a small knowledge base</em>,</strong> go with <strong><em>fully on-device agentic RAG</em></strong>.</li>
<li>If your <strong><em>knowledge base is large but privacy is still critical</em></strong>, a <strong><em>hybrid approach</em></strong> with a local agent and selective cloud retrieval makes sense.</li>
<li>For <strong><em>multi-source, complex reasoning tasks</em></strong>, <strong><em>cloud agentic RAG</em></strong> is still the best bet.</li>
<li>For <strong><em>offline or cost-sensitive scenarios</em></strong> with simpler queries, <strong><em>standard on-device RAG</em></strong> works well.</li>
<li>And when <strong><em>quality and speed</em></strong> are the top priorities, <strong><em>cloud agentic RAG</em></strong> remains the gold standard.</li>
</ul>
<h2 id="migrating-from-cloud-toedge">Migrating from Cloud to Edge</h2>
<p>If you’ve already built a cloud RAG pipeline and the decision framework above points you toward the edge, the good news is you won’t be starting over. The building blocks are same, which gives us a good base to modify our architecture for edge.</p>
<p><strong>What transfers cleanly:</strong> Your retrieval logic, prompt structure, and the agentic loop itself (reason → retrieve → act → respond) are all portable. A query still gets embedded, context still gets retrieved, and the agent still decides what to do. If you’ve designed your prompts and tool interfaces well, most of that thinking carries over directly.</p>
<p><strong>What needs rework:</strong> The hard part is that the assumptions are baked into a cloud deployment.</p>
<p>In cloud, memory is effectively infinite, the model is whatever API you point at, and latency is dominated by the network round-trip.</p>
<p>On edge, all three flip. You’ll need to swap your frontier model for an SLM and validate that it still handles your tasks (see Strategy 1), replace your managed vector DB with a lightweight local store, and budget real engineering time for the runtime and optimization layer: quantization, caching, and the hardware-specific quirks I mentioned earlier.</p>
<p>The components that have no cloud equivalent are on-device tool integrations. The optimization layer are where most of the migration effort actually goes.</p>
<p><strong>The honest answer, on difficulty</strong>:</p>
<ul>
<li>Porting the <em>happy path</em> is often a weekend-task.</li>
<li>Getting it <em>fast and reliable</em> on real hardware is where the weeks go.</li>
</ul>
<p>Teams assuming the migration is a model swap is a mistake, when it’s really a re-architecture around constraints and one must plan for the second one.</p>
<h2 id="optimizing-for-theedge">Optimizing for the Edge</h2>
<p>Running RAG on constrained hardware means you can’t afford to be wasteful. I covered four optimization strategies in the talk.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-Cjw2ZIuntdY7Q3U0BZboAA_hu_6ebd4b6343c8da7e.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-Cjw2ZIuntdY7Q3U0BZboAA_hu_d20fd64e96eb0046.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-Cjw2ZIuntdY7Q3U0BZboAA_hu_1bb0800574d0279f.jpeg" width="1440">
</picture><p><em>Four key strategies for optimizing edge-RAG performance. (Source: Author)</em></p>
<h2 id="strategy-1-slms-overllms">Strategy 1: SLMs Over LLMs</h2>
<p>The core insight here is that you don’t need a 70B-parameter model for most agentic tasks. Small Language Models (SLMs) in the 1.5B to 8B range are 10-30x cheaper at inference, can be fine-tuned in a few GPU-hours rather than weeks, and are perfectly sufficient for specialized, repetitive tasks like tool calls, formatting, and pattern matching.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-pqbu5G_emrA65C9SP8DpmQ_hu_42bc58c0eef49cb4.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-pqbu5G_emrA65C9SP8DpmQ_hu_a1060d23b5d356ad.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-pqbu5G_emrA65C9SP8DpmQ_hu_337d8a180c69505e.jpeg" width="1440">
</picture><p><em>Generalist versatility vs. specialist precision: LLMs are the jack of all trades, SLMs are the master of one. (Source: Author)</em></p>
<p>Think of it as <strong>generalist versatility vs. specialist precision</strong>. LLMs are the jack of all trades; SLMs are the master of one. For edge agentic workflows, you want the specialist.</p>
<blockquote>
  <p><strong>A great example of this in practice is Smolagents from Hugging Face. Using SmolVLM2–2.2B-Instruct as a base model, fine-tuned on the AGUVIS datasets, you can build a capable GUI automation agent in just 2.2B parameters. The model takes a UI screenshot and an instruction, reasons about previous action history, and outputs precise click coordinates, all running on-device.</strong></p>

</blockquote><picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-nVhjGc2oCCFkwVqc2tZt3g_hu_f92b48ad5679613f.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-nVhjGc2oCCFkwVqc2tZt3g_hu_8b9394f83d96d8cd.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-nVhjGc2oCCFkwVqc2tZt3g_hu_c54328b80442147c.jpeg" width="1440">
</picture><p><em>Smolagents: a 2.2B parameter model performing GUI automation with step-by-step reasoning. (Source: <a href="https://huggingface.co/smolagents/SmolVLM2-2.2B-Instruct-Agentic-GUI">Hugging Face : SmolVLM2–2.2B-Instruct-Agentic-GUI</a>)</em></p>
<h2 id="strategy-2-lightweight-retrieval-withminirag">Strategy 2: Lightweight Retrieval with MiniRAG</h2>
<p>Traditional vector similarity search can be computationally expensive on edge devices. <strong>MiniRAG</strong> takes a different approach by using heterogeneous graph indexing combined with lightweight graph-based knowledge retrieval.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-u81fmPST5-OBeeuZ0Tl9bg_hu_61dce1f55c7d3e6a.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-u81fmPST5-OBeeuZ0Tl9bg_hu_4063e07a36c64b.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-u81fmPST5-OBeeuZ0Tl9bg_hu_98fc68ba85fd1e39.jpeg" width="1440">
</picture><p><em>MiniRAG: heterogeneous graph indexing with topology-enhanced retrieval. (Source: <a href="https://arxiv.org/abs/2501.06713">Fan et al., “MiniRAG: Towards Extremely Simple Retrieval-Augmented Generation”</a>)</em></p>
<p>Instead of relying purely on dense embeddings, MiniRAG builds a graph with chunk nodes and entity nodes connected by entity-entity and entity-chunk edges. At query time, it performs semantic mapping to identify relevant entity types, then uses topology-enhanced graph retrieval to find the most relevant nodes and edges. This structured approach compensates for the limitations of smaller models and provides better reasoning paths with less compute.</p>
<p>What makes this a good fit for the edge is that workload is shifted from the SLM to the connected graph. Dense retrieval depends on how well the embedding model understands meaning, which is exactly where small models struggle. Graph retrieval instead leans on the structure of the graph, so finding the right information becomes a matter of following links between connected nodes rather than relying on the model to infer meaning.</p>
<h2 id="strategy-3-on-demand-embeddings">Strategy 3: On-Demand Embeddings</h2>
<p>Here’s a practical insight: you don’t need all your embeddings stored and ready to go at all times. The <strong>EdgeRAG</strong> approach uses a two-level index: large clusters with embeddings that take more than 500ms to generate are cached, while smaller, frequently accessed embeddings are generated on-demand at runtime.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-aMh0xNeXNrek5YoQBKaOsw_hu_4e46c5718cddf6c0.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-aMh0xNeXNrek5YoQBKaOsw_hu_cd6ccd929b63909c.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-aMh0xNeXNrek5YoQBKaOsw_hu_45a7fa96228ba428.jpeg" width="1440">
</picture><p><em>EdgeRAG’s two-level retrieval: cache large clusters, generate small embeddings on demand. (Source: <a href="https://arxiv.org/abs/2412.21023">Seemakhupt et al., “EdgeRAG: Online-Indexed RAG for Edge Devices”</a>)</em></p>
<p>The result:</p>
<blockquote>
  <p><strong>Up to 75% reduction in storage requirements while maintaining retrieval speed. The system uses a first-level index to quickly identify relevant clusters, checks an embedding cache, and only generates fresh embeddings when there’s a cache miss.</strong></p>

</blockquote><h2 id="strategy-4-kv-cache-optimization">Strategy 4: KV Cache Optimization</h2>
<p>KV (Key-Value) caching is a well-known technique for speeding up autoregressive generation in transformers. On edge devices, the key optimization is in how you <em>manage</em> that cache given limited memory.</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-xdDHdYj8XvstTOKYQkyzzQ_hu_8195a746ea2e525.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-xdDHdYj8XvstTOKYQkyzzQ_hu_4a3ac92e55102544.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-xdDHdYj8XvstTOKYQkyzzQ_hu_4f92db794517dea1.jpeg" width="1440">
</picture><p><em>KV caching: store once, reuse across generation steps. (Source: <a href="https://huggingface.co/blog/kv-cache-quantization">Hugging Face : KV Caching Explained</a>)</em></p>
<p>The approach involves offloading the KV cache to CPU RAM rather than keeping it in GPU memory, using a sliding window mechanism to keep the working set small, and applying delta encoding to reduce the cache’s memory footprint. This frees up precious GPU memory for the model itself and enables longer context windows without running into memory constraints.</p>
<h2 id="bonus-cache-architecture-matters-as-much-ascaching">Bonus: Cache Architecture Matters as Much as Caching:</h2>
<p>For multimodal agents, a single cache layer isn’t enough. You need a stack, an <strong>input-level cache</strong> that deduplicates near-identical inputs (a camera frame where nothing meaningful changed, an audio clip with the same content, a document where only metadata differs), an <strong>embedding cache</strong> that avoids re-running the encoder on byte-identical inputs, and the <strong>KV-cache</strong> for the LLM forward pass itself. Each layer protects the one below it: if the input-level cache misses, the embedding cache misses, which means new tokens in the prompt, which means the KV cache misses too. The optimization story is <em>how the caches compose</em>.</p>
<h2 id="things-to-keep-inmind">Things to Keep in Mind</h2>
<p>If I had to distill the talk into a single summary:</p>
<picture>
  <source type="image/webp"
          srcset="/posts/agentic-rag-in-edge-applications/assets/1-0mQd9hnxZW0No4IzrJt5_A_hu_1fc17acf6cc3d38b.webp 720w, /posts/agentic-rag-in-edge-applications/assets/1-0mQd9hnxZW0No4IzrJt5_A_hu_7a266408b3a967de.webp 1440w"
          sizes="(max-width: 768px) 100vw, 820px">
  <img decoding="async" height="810" loading="lazy" src="/posts/agentic-rag-in-edge-applications/assets/1-0mQd9hnxZW0No4IzrJt5_A_hu_ce2cc568a79fae79.jpeg" width="1440">
</picture><p><em>The five focus areas for practical edge-RAG deployment</em></p>
<p>That last row is perhaps the most important takeaway. The temptation with edge AI is to try to replicate the full sophistication of a cloud pipeline. Instead, accept the constraints upfront, keep your agentic steps simple and decomposed, and prioritize practical deployment over architectural elegance. Complexity that works beautifully in the cloud will break on constrained hardware.</p>
<h2 id="wrapping-up">Wrapping Up</h2>
<p>Edge-RAG is no longer a theoretical exercise. The tools are available. The models are small enough, and the optimization techniques are mature enough to build real, useful agentic systems that run entirely on-device. The effort needed is to understand if the use case demands migration to Edge-RAG.</p>
<p>For most applications, the cloud is still the right answer, and that’s fine. But when privacy, compliance, offline capability, or cost at scale move from “nice to have” to “non-negotiable,” edge-RAG goes from an interesting experiment to the obvious choice. Which simply forces one to think what components belong to edge.</p>
<h2 id="update-whats-changed-since-october2025">Update: What’s Changed Since October 2025</h2>
<p>The edge AI landscape has moved fast since this talk. The core thesis still holds, but a few specifics deserve an update.</p>
<p><strong>Small models have leapfrogged</strong>. <em>Gemma 4</em> (April 2026) shipped E2B and E4B variants designed explicitly for on-device deployment. <em>Phi-4</em> added a vision-reasoning variant that decides for itself when to use chain-of-thought. Qwen3 brought in dual-mode reasoning down to the 8B tier. The SLM-over-LLM argument has a lot more evidence behind it than it did when I gave the talk.</p>
<p><strong>Speculative decoding is the optimization I should have covered</strong>. Using a tiny draft model to predict multiple tokens ahead and verifying them in parallel with the main model has become the dominant inference optimization for edge devices. If I were giving the talk today, it would be Strategy 5.</p>
<p><strong>The real bottleneck turned out to be memory bandwidth, not compute</strong>. On edge devices, generating each token requires streaming the full model weights through memory. <a href="https://www.insight.com/en_US/content-and-resources/glossary/t/tera-operations-per-second.html">TOPS</a> gets all the marketing attention, but it’s memory bandwidth that determines actual decode speed which reframes how you think about quantization and model selection.</p>
<p>Everything else: the four pillars, the decision framework, the “keep it simple” principle still holds. If anything, the improving capability of small models makes the case for edge-RAG stronger today than it was seven months ago.</p>
<h2 id="references-and-furtherreading">References and Further Reading</h2>
<ul>
<li><a href="https://arxiv.org/pdf/2506.02153">Small Language Models are the Future of Agentic AI</a></li>
<li><a href="https://developers.google.com/edge">Google AI Edge</a></li>
<li><a href="https://arxiv.org/pdf/2509.03891">MobileRAG: Enhancing Mobile Agent with Retrieval-Augmented Generation</a></li>
<li><a href="https://arxiv.org/pdf/2501.06713">MiniRAG: Towards Extremely Simple Retrieval-Augmented Generation</a></li>
<li><a href="https://arxiv.org/pdf/2412.21023v1">EdgeRAG: Online-Indexed RAG for Edge Devices</a></li>
<li><a href="https://huggingface.co/blog/not-lain/kv-caching">KV Caching Explained: Optimizing Transformer Inference Efficiency</a></li>
</ul>
<p><em>Bonus Read:</em> <a href="https://arxiv.org/pdf/2510.04871"><em>Less is More: Recursive Reasoning with Tiny Networks</em></a></p>
]]></content:encoded></item></channel></rss>