<?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 Neehanth Reddy Maramreddy on Medium]]></title>
        <description><![CDATA[Stories by Neehanth Reddy Maramreddy on Medium]]></description>
        <link>https://medium.com/@neehanthreddym?source=rss-92249a1c94d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*h_pi9KHz4TeXsg1UkY-xDA.png</url>
            <title>Stories by Neehanth Reddy Maramreddy on Medium</title>
            <link>https://medium.com/@neehanthreddym?source=rss-92249a1c94d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:45:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@neehanthreddym/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[Your AI App Is Not Failing Because of the Model.]]></title>
            <link>https://medium.com/@neehanthreddym/your-ai-app-is-not-failing-because-of-the-model-357999d65666?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/357999d65666</guid>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[genai]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 18:11:56 GMT</pubDate>
            <atom:updated>2026-03-30T19:24:39.530Z</atom:updated>
            <content:encoded><![CDATA[<h3>Your AI App Is Not Failing Because of the Model. It Is Failing Because the Logic Is Still in the Prompt</h3><p>A lot of AI products look solid in the first demo.</p><p>You upload an input.<br>- The model responds.<br>- The output looks smart enough.<br>- Everyone feels like the hard part is done.</p><p>Then real usage starts.</p><p>That is where I ran into the actual engineering problem while building an AI resume screener designed to evaluate candidate-job fit more like a senior recruiter than a keyword matcher.</p><p>On paper, the workflow was simple:</p><p>Upload a job description.<br>- Upload a resume.<br>- Return a match score, a skill-gap analysis, and a hiring recommendation.</p><p>The first version worked.</p><p>But it was not trustworthy.</p><p>And that is the moment where many AI applications quietly break: not because the model is bad, but because too much system logic is still living inside the prompt.</p><h3>The real problem was not generation. It was control.</h3><p>As soon as I moved beyond the happy path, the system started showing failure modes that were easy to miss in a demo but impossible to ignore in a real product.</p><p>The model hallucinated skills from the wrong parts of the job description. Academic coursework got treated like professional experience. Scoring shifted across runs. Transferable skills were missed because they did not match exact wording. The pipeline added unnecessary latency because independent steps were running sequentially. And relying on a single model provider created a reliability bottleneck.</p><p>Each issue looked different on the surface.</p><p>But the pattern was the same.</p><p>Every time I let the LLM make a system-level decision, the pipeline became harder to trust, harder to debug, and harder to scale.</p><p>That pushed me toward a much cleaner principle:</p><p><strong>LLMs should generate language. Systems should enforce logic.</strong></p><p>That one shift changed how I designed the rest of the screener.</p><h3>What I was building</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_FOCFTCE8-PKpf2RKFhvg.png" /></figure><p>The screener accepts a job description and a resume, parses the files, extracts relevant skills and requirements, analyzes gaps, and returns structured outputs such as match score, verdict, red flags, and interview focus areas.</p><p>Under the hood, it is a LangGraph-based pipeline rather than a chatbot. The flow is deterministic, stateful, and built around typed outputs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*_mrjSB1gy6TGuPqC8MkFBg.png" /><figcaption>LangGraph pipeline</figcaption></figure><p>That distinction matters.</p><p>A chatbot can get away with being loosely structured. A hiring workflow cannot.</p><p>If a candidate gets marked as “Hold” in one run and “Reject” in the next, the product loses credibility immediately.</p><h3>Problem 1: the model hallucinated skills from responsibility sections</h3><p>The job description extractor was picking up verbs and actions from responsibility statements and turning them into skills.</p><p>For example, a sentence like “architect scalable backend systems” could lead the model to extract “architect” as a skill. That is not useful. It is just leakage from the sentence structure.</p><p>The fix was not adding more clever prompting in the abstract. It was narrowing the model’s scope.</p><p>I constrained extraction to only the requirements and qualifications sections and explicitly blocked verbs, actions, and responsibility phrases from being treated as skills.</p><p>This is a good example of a broader lesson in AI engineering: when the model does not know where the boundary is, you need to define the boundary outside the model’s intuition.</p><h3>Problem 2: academic courses were inflating candidate quality</h3><p>This showed up especially with recent graduates.</p><p>Resume extraction was treating course names like “Algorithms” or “Database Systems” as professional capabilities, which inflated match scores against more experienced candidates.</p><p>The model was not exactly wrong in a linguistic sense. Those are technical terms. But they are not evidence of production experience.</p><p>So I added explicit extraction constraints to separate academic coursework from real professional skills.</p><p>That was a prompt-level fix, but it worked because the rule was narrow, concrete, and domain-specific. Not every issue needs a big architectural rewrite. Some issues need a better boundary.</p><h3>Problem 3: LLM-based scoring made the system non-deterministic</h3><p>This was the biggest design mistake in the early version.</p><p>Originally, I asked the LLM to apply calibration modes like “strict” or “lenient” and adjust the score accordingly.</p><p>It sounded elegant. It was not.</p><p>The same resume could get different scores across runs because the model was generating both reasoning and scoring behavior. That is unacceptable in any system that needs consistency, auditability, or user trust.</p><p>So I moved score calibration into deterministic Python.</p><p>The LLM still explains the reasoning in natural language. But the numeric score is produced by explicit formulas and rule-based adjustments.</p><p>That one change made the system dramatically easier to reason about.</p><p>It also clarified something important:</p><p><strong>Natural language judgment can be probabilistic. Final scoring should not be.</strong></p><h3>Problem 4: transferable skills were being rejected because they did not string-match</h3><p>This is one of the most common traps in evaluation systems.</p><p>A job description asks for “distributed systems.”<br> A resume lists Apache Kafka.<br> A naive system treats that as a gap because the words do not match exactly.</p><p>But any decent reviewer knows Kafka can be evidence of distributed systems experience.</p><p>I improved this in two ways.</p><p>First, I strengthened the analysis instructions with concrete mapping examples, such as technology-to-concept relationships. Second, I made the reasoning explicitly accept transferable skills when the candidate’s experience clearly covers the requirement, even if the wording differs.</p><p>This moved the screener closer to how experienced recruiters actually reason: not by exact string overlap, but by evidence and coverage.</p><h3>Problem 5: the pipeline was slower than it needed to be</h3><p>My original LangGraph flow was fully sequential:</p><p>Start → extract JD → extract resume → analyze gaps → recommend</p><p>That was logically valid, but operationally wasteful.</p><p>Job description extraction and resume extraction do not depend on each other. There is no reason to wait for one before starting the other.</p><p>So I refactored the graph into a parallel fan-out pattern:</p><p>Start → extract JD and extract resume concurrently<br> Then fan in to gap analysis<br> Then generate the final recommendation</p><p>Using async extraction reduced end-to-end latency significantly. More importantly, it forced the pipeline design to better reflect the actual dependency graph of the task.</p><p>A lot of performance issues in AI systems are not model issues. They are orchestration issues.</p><h3>Problem 6: one provider became one point of failure</h3><p>Free-tier rate limits and transient availability issues made it clear that a single-provider setup was fragile.</p><p>So I added a multi-provider LLM factory with a provider-agnostic interface. That meant I could switch providers through configuration without rewriting pipeline logic.</p><p>This is one of those design choices that feels optional in a prototype and essential in production.</p><p>If model routing is tightly coupled to workflow logic, every provider change becomes a refactor. If it is abstracted cleanly, model selection becomes an operational choice instead of an engineering rewrite.</p><h3>The architecture changed when I stopped treating prompts like system design</h3><p>That was the bigger lesson from this project.</p><p>Prompts are useful for extracting meaning, generating explanations, and handling ambiguity in language.</p><p>But prompts should not be carrying your scoring rules, business policies, control flow, or reliability strategy.</p><p>Those belong in code.</p><p>Once I started pulling non-language decisions out of the model, the system became easier to test, easier to trust, and easier to evolve.</p><p>The resulting stack reflected that shift:</p><p>LangGraph for orchestration.<br> Pydantic-typed outputs for structure.<br> Async fan-out for latency reduction.<br> Provider-agnostic routing for resilience.<br> Prompting for interpretation, not control.</p><p>That is the difference between a flashy demo and a system you can actually operate.</p><h3>A practical rule I now use for AI systems</h3><p>When building an LLM application, I ask one question repeatedly:</p><p><strong>Does this decision need language understanding, or does it need consistency?</strong></p><p>If it needs language understanding, the model can help.<br> If it needs consistency, it should live in deterministic code.</p><p>That single distinction helps separate what should stay probabilistic from what must become explicit.</p><p>And that separation matters more than most prompt improvements ever will.</p><h3>Final takeaway</h3><p>Production AI is not about writing a smarter prompt.</p><p>It is about deciding, very carefully, which parts of your system are allowed to be probabilistic.</p><p>That is the design shift I keep seeing across serious AI products.</p><p>The sooner you make it, the sooner your system stops behaving like a demo and starts behaving like software.</p><p>♻️ Found this useful? Share it with someone who is into the AI world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>LinkedIn: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=357999d65666" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What If Attention Stopped Echoing Itself? A Simple Look at Exclusive Self Attention]]></title>
            <link>https://medium.com/@neehanthreddym/what-if-attention-stopped-echoing-itself-a-simple-look-at-exclusive-self-attention-8795945111d2?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8795945111d2</guid>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 13:01:02 GMT</pubDate>
            <atom:updated>2026-03-27T13:01:02.940Z</atom:updated>
            <content:encoded><![CDATA[<p>Most transformer papers try to improve models by adding more complexity.</p><p>This one does something more interesting: it asks whether attention is wasting effort on the wrong job.</p><p>The paper, <a href="https://arxiv.org/pdf/2603.09078"><em>Exclusive Self Attention</em></a>, starts from a sharp observation. In standard self-attention, the output often ends up looking a lot like the current token’s own value vector. In other words, attention is not always bringing back fresh context. Sometimes it is just returning a polished version of what the token already had. The authors call this <strong>attention similarity bias</strong> and propose a small fix: subtract the self-like part of attention so the layer can focus more on context.</p><p>That sounds small. But the idea is bigger than it looks.</p><p>Because if the hypothesis is right, then one of the most important pieces of a transformer has been slightly misused all along.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*tR61rjJB5S0wzfptL_sBzA.png" /><figcaption>Standard attention vs XSA at a glance</figcaption></figure><h3>The paper’s core idea</h3><p>A transformer has more than one way to carry information forward.</p><p>Residual connections already preserve the current token’s representation. The feed-forward network already does token-wise transformation. So what should attention be best at?</p><p>The paper’s answer is simple: <strong>context</strong>.</p><p>Attention should be the part of the model that asks, “What do the other tokens tell me right now?” But if attention keeps mixing in information aligned with the token’s own value vector, then it is partly duplicating work that other parts of the model already do. That overlap, according to the paper, reduces modeling efficiency.</p><p>So XSA draws a cleaner line between responsibilities:</p><ul><li>residual path + FFN handle token-local information</li><li>attention handles context</li></ul><p>That separation is the whole philosophy of the paper.</p><h3>A plain-English way to think about it</h3><p>Imagine a class discussion.</p><p>A student asks the room for ideas. But instead of listening to everyone else, they mostly hear their own voice bouncing back.</p><p>That is the paper’s complaint about standard attention.</p><p>XSA is basically a filter that says: when you ask the room for context, remove the part that is just your own voice.</p><p>That makes the attention output more “about others” and less “about self.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*lFVcbqp3ff4WvyJz9xUVig.png" /><figcaption>Self-echo vs context: the intuition behind XSA</figcaption></figure><h3>What XSA changes mathematically</h3><p>The method is surprisingly compact.</p><p>Standard self-attention produces an output vector for each token. XSA then removes the projection of that output onto the token’s own value vector. So if the attention output has a component pointing in the same direction as the token’s own representation, that part gets subtracted out. The paper says this removes the attention similarity bias and encourages the layer to focus on contextual information instead. It can be implemented with a minimal code change on top of standard attention.</p><p>That is what makes the paper compelling. It is not a giant architectural rewrite. It is a surgical correction.</p><h3>A toy example that makes the idea click</h3><p>Take the sentence:</p><p><strong>“The cat sat because it was tired.”</strong></p><p>Suppose the current token is <strong>“it.”</strong></p><p>Ideally, attention should help “it” pull useful clues from earlier tokens like “cat,” “sat,” and “because.” But the paper argues that attention often also drifts toward the token’s own direction.</p><p>You can picture that as a vector problem.</p><p>Let the token’s own value vector point horizontally:</p><p>Let the token’s own value vector point horizontally:</p><p><strong>v_it = [2, 0]</strong></p><p>Now suppose standard attention returns:</p><p><strong>y = [1.05, 0.45]</strong></p><p>That output has two parts:</p><ul><li>a horizontal, self-like part</li><li>a vertical, context-like part</li></ul><p>XSA removes the horizontal projection and keeps what is left:</p><p><strong>z = [0, 0.45]</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgjGBnwWyU_LxbfiNnB3hg.png" /></figure><p>That toy example is just for intuition, but it captures the paper’s message well:</p><p><strong>standard attention = self + context</strong></p><p><strong>XSA = context after removing self-echo</strong></p><h3>Why this matters beyond the math</h3><p>A lot of transformer research is driven by a simple question: where is the model spending capacity?</p><p>This paper suggests that some attention capacity may be going toward something the architecture already handles elsewhere. If that is true, then improving transformers is not only about making attention stronger. It may also be about making attention more specialized.</p><p>That is a subtle but important shift in thinking.</p><p>Instead of asking, “How do we add more power?” the paper asks, “How do we stop wasting the power we already have?”</p><h3>What the experiments show</h3><p>The authors test XSA in a standard language modeling setup using NanoGPT-style training with RoPE and the FineWeb-100BT dataset, training for about 100B tokens. They evaluate models across three sizes up to 2.7B parameters.</p><p>The headline result is that XSA consistently beats the baseline transformer in the paper’s experiments.</p><p>The authors report that XSA adds only minimal computational overhead, improves training and validation loss across all three tested model sizes, improves average downstream evaluation results, maintains its gains across different learning rates, gets stronger as sequence length increases, and remains robust when attention sinks are added.</p><p>That last point matters more than it first appears. Plenty of ideas work once under one training setup and then fall apart. This paper tries to show that XSA is not just a lucky setting.</p><h3>The results that stand out most</h3><p>One of the strongest signals is consistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Ri8t7QzdmhPv1-W7WYn5Q.png" /></figure><p>Across three model sizes, XSA maintains a better training and validation loss curve than the baseline. On downstream tasks, the average accuracy also improves, with the reported average gain increasing from +0.26 at 0.7B to +1.03 at the middle-sized model and +1.36 at 2.7B.</p><p>The other especially interesting result is sequence length.</p><p>The paper tests sequence lengths from 512 all the way to 16,384 tokens and reports that XSA’s gains become larger as context length increases. The authors suggest that longer contexts create more pressure on context modeling, which makes the benefit of XSA more visible.</p><p>If that trend holds at larger scales, XSA could be more than a neat trick. It could become a meaningful idea for long-context transformer design.</p><h3>Why the paper is worth paying attention to</h3><p>There are three reasons this paper is memorable.</p><p>First, the idea is easy to state. That is often a good sign in research. Strong ideas usually compress well.</p><p>Second, the mechanism matches the hypothesis. The authors say attention is too self-aligned, and the fix directly removes the self-aligned component.</p><p>Third, the empirical story is clean. The reported gains are not isolated to one plot or one benchmark. They show up in loss, downstream evaluation, learning-rate sweeps, long-context settings, and attention-sink comparisons.</p><p>That combination makes the paper feel more serious than many “small tweak” papers.</p><h3>Where to stay cautious</h3><p>The paper is promising, not final.</p><p>The authors are explicit that there are still open questions: whether XSA continues to work at larger model and data scales, whether it is compatible with other optimizers, and whether it helps on tasks or modalities beyond language modeling.</p><p>So this is not yet a “replace standard attention everywhere” result.</p><p>It is better framed as a strong research clue:</p><p>maybe part of the transformer’s success has come with a hidden inefficiency, and maybe a cleaner division of labor inside the block can improve how models use capacity.</p><h3>Final takeaway</h3><p>The smartest part of this paper is not the formula.</p><p>It is the question behind the formula.</p><p>What if attention should not be trying to preserve the token itself at all? What if its real job is to return only what the rest of the sequence adds?</p><p>That is the intuition behind Exclusive Self Attention.</p><p>And if the paper’s results continue to hold in future work, this could end up being one of those deceptively small ideas that changes how people think about transformer design.</p><p>♻️ Found this useful? Share it with someone who is into the AI world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>LinkedIn: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8795945111d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Engineering Is No Longer Just Prompting: It’s System Design]]></title>
            <link>https://medium.com/@neehanthreddym/ai-engineering-is-no-longer-just-prompting-its-system-design-b1f5bd0d6d12?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1f5bd0d6d12</guid>
            <category><![CDATA[ai-observability]]></category>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[ai-production]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 13:01:03 GMT</pubDate>
            <atom:updated>2026-03-24T13:01:03.578Z</atom:updated>
            <content:encoded><![CDATA[<p>Source: <a href="https://youtu.be/CyLYY_xb5bQ?si=ZYJfsIi9ltIBGTgi">You Can Learn AI Agent System Design In 19 Min | RAG, Vector Database, Evals, Function Calling</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dK0_vlatEl-0H-B1sUBepA.gif" /></figure><p>AI engineering is maturing fast, and this is exactly why videos like this matter for both beginners and experienced builders.</p><p>A lot of people enter AI through models, prompts, and demos. But production AI does not succeed because the model sounds smart. It succeeds because the system is designed well. That means clear goals, defined scope, routing logic, tool use, policy checks, human handoff, latency targets, and observability.</p><p>That is the real shift this walkthrough captures.</p><p>The example is customer support for e-commerce: returns, exchanges, and “where is my order?” On the surface, it looks like a chatbot problem. In practice, it is a systems problem. You need a gateway for authentication and privacy, a router agent to detect intent, a Q&amp;A layer to keep the experience responsive, planners to decide what happens next, APIs to take actions, a vector database for policy retrieval, and humans in the loop when confidence is low or emotion is high.</p><p>That is the mindset AI engineers need now.</p><p>For newcomers, this is important because it reframes the field. AI engineering is not only about learning one framework or one model API. It is about learning how to connect models to workflows, data, tools, business rules, and user experience. This is where many early learners get stuck: they build something that works in a notebook but breaks in reality.</p><p>For experienced engineers, the value is different. It is a reminder that reliability often comes from reducing unnecessary agent behavior. One of the strongest ideas in the transcript is that not every step needs an agent. If the workflow is fixed, deterministic logic may be better. That is an important production lesson: use agents where reasoning is needed, and use software where predictability matters.</p><p>The other big takeaway is that good AI systems are measurable. The transcript defines concrete goals: automation rate, customer satisfaction, and response latency. That is exactly how serious AI products should be built. Without evals and observability, even a clever agent architecture is still guesswork.</p><p>This is why this topic matters so much right now. AI engineering is moving beyond “build a chatbot” into architecture, evals, observability, guardrails, and agent-tool orchestration. Recent writing across Medium, Substack, and industry coverage keeps circling the same themes: agent reliability, observability, evaluation, guardrails, RAG, and tool-connected systems.</p><p>The biggest lesson here is simple:<br> <strong>AI products become useful when they stop being model demos and start becoming well-designed systems.</strong></p><p>That is the difference between experimenting with AI and engineering it.</p><p>♻️ Found this useful? Share it with someone who is into the AI world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>LinkedIn: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1f5bd0d6d12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLM Fine-Tuning Explained: When to Use It, How LoRA Works, and Why QLoRA Changed the Game]]></title>
            <link>https://medium.com/@neehanthreddym/llm-fine-tuning-explained-when-to-use-it-how-lora-works-and-why-qlora-changed-the-game-e0b2865568c4?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0b2865568c4</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Sun, 22 Mar 2026 03:01:45 GMT</pubDate>
            <atom:updated>2026-03-22T03:01:45.698Z</atom:updated>
            <content:encoded><![CDATA[<p>Large language models are impressive out of the box. They can answer questions, summarize text, generate code, and carry conversations with surprising fluency.</p><p>But general ability is not the same as domain-specific usefulness.</p><p>A base model may know a lot about the internet, yet still fail at the exact thing a business or product team needs. It may not know internal company policies. It may not speak in the right tone. It may not follow the response format your workflow depends on. It may answer correctly in spirit, but poorly in style.</p><p>That gap is where <strong>LLM fine-tuning</strong> becomes important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W00A8-6kxJ3QCaKJJ6HDIw.png" /></figure><p>Fine-tuning is not about building a model from scratch. It is about taking an already capable model and adapting it so it performs better on a narrower task, dataset, or response pattern. And in modern LLM systems, that adaptation is often done with methods like <strong>LoRA</strong> and <strong>QLoRA</strong>, which make the process dramatically more practical.</p><p>Google Colab Notebook: <a href="https://colab.research.google.com/drive/1f9T3Zmn9U70qYIyhMUFrcHbolUiu-9pe?usp=sharing">fintune_LLM_unsloth</a></p><h3>Why fine-tuning exists in the first place</h3><p>Pre-trained LLMs are trained on massive amounts of text. That gives them broad language understanding and strong generalization. But in real-world applications, teams usually need something more specific.</p><p>You might want a model that can:</p><ul><li>answer based on private company knowledge</li><li>respond in a brand-specific tone</li><li>follow a consistent structure</li><li>produce better domain-specific outputs</li><li>mimic a reasoning style for a particular class of problems</li></ul><p>A general model can get you part of the way there. Fine-tuning helps close the remaining gap.</p><p>The simplest way to think about it is transfer learning: the model already has the raw skill, and fine-tuning helps redirect that skill toward your use case.</p><h3>Fine-tuning vs RAG: they solve different problems</h3><p>One of the biggest mistakes in LLM system design is treating retrieval-augmented generation and fine-tuning as interchangeable. They are not.</p><p>They solve different problems.</p><h4>Use RAG when the model needs knowledge</h4><p>If the model needs access to private documents, internal databases, product manuals, or frequently changing content, <strong>RAG</strong> is usually the right tool. It retrieves relevant context at inference time and feeds it to the model.</p><p>This is especially useful when the missing information is not in the model’s training data.</p><h4>Use fine-tuning when the model needs behavior changes</h4><p>If the model already has enough context, but its responses are not in the right tone, structure, style, or task-specific format, <strong>fine-tuning</strong> is a better fit.</p><p>Fine-tuning helps the model behave differently. It can teach the model to be more concise, more empathetic, more structured, more domain-aware, or better aligned to a task pattern.</p><h4>In practice, strong systems often use both</h4><p>This is the real takeaway.</p><ul><li>RAG adds external knowledge</li><li>Fine-tuning shapes response behavior</li></ul><p>If your application needs private knowledge and better response style, the best answer is often a combination of both.</p><h3>Base models and instruct models are not the same thing</h3><p>Another useful distinction is the difference between a <strong>foundation model</strong> and an <strong>instruct model</strong>.</p><p>A base model is essentially trained for next-token prediction. It learns to continue text. That makes it powerful, but not necessarily easy to use directly in assistant-style applications.</p><p>An instruct model has already been adapted further using instruction-following data. That is why it feels much more natural in chat settings. It is better at taking tasks like:</p><ul><li>summarize this</li><li>translate this</li><li>explain this step by step</li><li>answer in a specific format</li></ul><p>This matters because it shows that fine-tuning is not just a niche optimization step. It is already part of how many useful LLM variants are created.</p><h3>Two paths: full fine-tuning and parameter-efficient fine-tuning</h3><p>Once you decide to adapt a model, there are two broad ways to do it.</p><h4>Full fine-tuning</h4><p>In full fine-tuning, you update all the model weights.</p><p>This gives maximum flexibility, but it is expensive. Large models have billions of parameters, which means large memory requirements, slower training, and higher compute costs.</p><p>For many teams, this is simply too heavy.</p><h4>Parameter-efficient fine-tuning</h4><p>Parameter-efficient fine-tuning, often shortened to <strong>PEFT</strong>, takes a different approach.</p><p>Instead of retraining the full model, it keeps most of the original weights frozen and trains only a much smaller set of added parameters.</p><p>This makes fine-tuning cheaper, lighter, and faster.</p><p>And that is where <strong>LoRA</strong> comes in.</p><h3>LoRA: the practical breakthrough</h3><p><strong>LoRA</strong> stands for <strong>Low-Rank Adaptation</strong>.</p><p>The core idea is elegant.</p><p>Instead of modifying the full weight matrices inside the model, LoRA keeps the original weights frozen and learns a small update on top of them. That update is represented in a low-rank form, which means it is factorized into two smaller matrices.</p><p>Instead of training a full update matrix directly, LoRA learns:</p><p><strong>ΔW = A × B</strong></p><p>This dramatically reduces the number of trainable parameters.</p><p>Why does that matter?</p><p>Because the bottleneck in fine-tuning large models is not just “can you run training?” It is also:</p><ul><li>how much memory is required</li><li>how expensive optimization becomes</li><li>how quickly you can iterate</li><li>how practical experimentation is</li></ul><p>LoRA reduces those costs without throwing away the value of the pretrained model.</p><h4>What “rank” means in LoRA</h4><p>LoRA introduces a rank hyperparameter, usually written as r.</p><p>This controls the capacity of the learned update.</p><ul><li>lower rank means fewer trainable parameters and lower cost</li><li>higher rank gives more flexibility, but uses more memory and compute</li></ul><p>There is no universal best value. It depends on the task, data quality, model size, and performance target. But conceptually, rank is the knob that controls how expressive the adapter is.</p><h3>Quantization: making big models fit smaller hardware</h3><p>Even with LoRA, model size still matters.</p><p>A large model can be expensive just to load into memory. That is where <strong>quantization</strong> becomes important.</p><p>Quantization reduces the precision used to store weights. For example:</p><ul><li>32-bit weights use more memory</li><li>8-bit weights use much less</li><li>4-bit formats reduce memory even further</li></ul><p>The tradeoff is simple: lower precision can introduce some information loss, but in many real systems the quality drop is small enough to be worth the memory savings.</p><p>This is one of the key reasons quantization has become so important in practical LLM work. It turns models that are too large to handle comfortably into models that are actually usable.</p><h3>Why normal 4-bit quantization is not enough</h3><p>Neural network weights are not distributed uniformly. Many tend to cluster around zero.</p><p>That matters because if you use naive equal-width quantization bins, you may waste representational capacity in parts of the number range where weights rarely occur, while compressing the dense region near zero too aggressively.</p><p>That is why <strong>NF4</strong> matters.</p><h3>NF4: a smarter 4-bit format</h3><p><strong>NF4</strong>, or <strong>NormalFloat4</strong>, is designed around the observation that model weights often follow a roughly normal distribution.</p><p>Instead of treating all numeric ranges equally, NF4 allocates its limited 4-bit representation in a way that better matches where the weights actually are.</p><p>The practical result is straightforward:</p><ul><li>you still get the memory savings of 4-bit storage</li><li>you preserve model quality better than with naive low-bit quantization</li></ul><p>This is one of the reasons NF4 became such an important piece of the QLoRA story.</p><h3>QLoRA: quantization plus LoRA</h3><p>If LoRA makes fine-tuning lighter, and quantization makes models smaller, then <strong>QLoRA</strong> combines both ideas into one practical recipe.</p><p>QLoRA works by:</p><ol><li>loading the pretrained model in 4-bit form</li><li>keeping those base weights frozen</li><li>training LoRA adapters on top</li></ol><p>This means you do not need full-precision training of the entire model. You keep the memory footprint low while still adapting the model effectively.</p><p>That is the big unlock.</p><p>QLoRA made it possible to fine-tune much larger models on far more modest hardware than people previously assumed.</p><h3>What makes QLoRA especially powerful</h3><p>QLoRA is not just “LoRA, but smaller.”</p><p>It also includes additional memory-saving ideas such as:</p><ul><li><strong>double quantization</strong>, which compresses quantization-related metadata further</li><li><strong>paged optimizers</strong>, which help manage memory spikes during training</li></ul><p>You do not need to memorize those details to understand the concept. The important point is that QLoRA is a systems-level answer to a practical problem: how do you fine-tune large models without requiring huge GPU budgets?</p><p>And the answer is: compress the base model, freeze it, and only train compact adapters.</p><h3>Where fine-tuning actually helps</h3><p>Fine-tuning is often most useful when you care about one or more of the following:</p><p><strong>1. Consistent response format</strong></p><p>You want outputs in a specific schema, template, or style.</p><p><strong>2. Domain-specific behavior</strong></p><p>You want better performance on a narrow task class, not just broad general knowledge.</p><p><strong>3. Brand or product voice</strong></p><p>You need a model to sound aligned with your product experience.</p><p><strong>4. Reasoning style or answer structure</strong></p><p>You want the model to respond in a more deliberate, stepwise, or policy-driven format.</p><p><strong>5. Task adaptation</strong></p><p>You want the model to perform better on a repeated type of example from your domain.</p><p>This is where fine-tuning starts to feel less like research and more like product engineering.</p><h3>A practical fine-tuning workflow</h3><p>Underneath the tooling and notebooks, the conceptual workflow is fairly simple.</p><h4>Step 1: Choose a pretrained model</h4><p>Start with a base or instruct model that is already strong enough for your use case.</p><h4>Step 2: Decide whether to quantize</h4><p>If hardware is limited, use quantization to reduce memory requirements.</p><h4>Step 3: Attach LoRA adapters</h4><p>Choose which modules to adapt and configure hyperparameters like rank and scaling.</p><h4>Step 4: Prepare the dataset</h4><p>This is where a lot of real value comes from. Your dataset teaches the model what “better behavior” looks like.</p><h4>Step 5: Format examples into training text</h4><p>The examples need to reflect the type of interaction you want at inference time.</p><h4>Step 6: Run supervised fine-tuning</h4><p>Train the adapters while keeping the base model mostly or fully frozen.</p><h4>Step 7: Evaluate on representative prompts</h4><p>Do not just look at loss. Test whether the model behaves better on actual use-case prompts.</p><h4>Step 8: Save and deploy the adapted model</h4><p>Often this means saving the adapter weights rather than a fully merged model.</p><p>That is the core process, regardless of the exact framework used.</p><h3>The real lesson: modern fine-tuning is about efficient adaptation</h3><p>The most useful mental model is this:</p><p>Old intuition says fine-tuning means retraining a big model.</p><p>Modern practice says fine-tuning means making <strong>targeted, efficient changes</strong> to an already powerful model.</p><p>That shift matters.</p><p>It is why small teams can now adapt strong models.<br> It is why experimentation is cheaper.<br> It is why product-specific LLM behavior is increasingly accessible.</p><p>And it is why methods like LoRA and QLoRA matter so much. They do not just improve training efficiency. They change what is feasible.</p><h3>Final takeaway</h3><p>LLM fine-tuning is best understood as a way to specialize a pretrained model for a narrower job.</p><ul><li><strong>RAG</strong> helps when the model needs more knowledge</li><li><strong>Fine-tuning</strong> helps when the model needs better behavior</li><li><strong>LoRA</strong> makes fine-tuning practical by training a small low-rank update instead of the full model</li><li><strong>Quantization</strong> reduces memory usage</li><li><strong>QLoRA</strong> combines both ideas so larger models can be adapted on smaller hardware budgets</li></ul><p>That is the real concept.</p><p>Fine-tuning is no longer about brute-force retraining. It is about efficient specialization.</p><p>♻️ Found this useful? Share it with someone who is into the AI world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>LinkedIn: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0b2865568c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Document Parsing Trap]]></title>
            <link>https://medium.com/@neehanthreddym/the-document-parsing-trap-bc0781b2ab8b?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc0781b2ab8b</guid>
            <category><![CDATA[trending]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[data-preprocessing]]></category>
            <category><![CDATA[resume-screening-tool]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Fri, 20 Mar 2026 13:01:01 GMT</pubDate>
            <atom:updated>2026-03-20T13:01:01.211Z</atom:updated>
            <content:encoded><![CDATA[<p>How I moved from naive PDF/DOCX parsing to an agentic extraction node built for real-world document formatting</p><p>Most people building AI document workflows make the same assumption early on:</p><p>Once the text reaches the LLM, the hard part is over.</p><p>That sounds reasonable until you ship something real.</p><p>You upload a resume, a job description, or a policy document. You pass the extracted text into an LLM. You expect structured output, strong reasoning, and maybe even recruiter-like judgment. Instead, you get weird skill matches, missing sections, vague summaries, and extraction errors that look like hallucinations.</p><p>The instinct is to blame the prompt.</p><p>In reality, the problem often starts much earlier.</p><p>If your parsing layer destroys the semantic structure of the document, your LLM is reasoning over broken input. And once layout, ordering, or section boundaries are lost, no prompt can reliably reconstruct them.</p><p>That was the trap I ran into while building an <a href="https://github.com/neehanthreddym/agentic-resume-screener">AI-powered resume screener</a>: an agentic pipeline designed to reason about candidate-job fit beyond keyword matching. The breakthrough was not a better extraction prompt. It was treating document parsing as a first-class engineering problem.</p><h3>Why parsing matters more than most AI tutorials admit</h3><p>A lot of tutorials simplify document ingestion into a utility step.</p><p>For PDFs, they recommend pdfplumber.<br>For Word files, they recommend iterating through document.paragraphs with python-docx.</p><p>That works for clean, linear documents.</p><p>But resumes are rarely clean or linear.</p><p>They use two-column layouts, section sidebars, skill grids, invisible tables, compressed formatting, and visual alignment tricks meant for human readers. Standard parsers often flatten these designs into text that is technically extracted but semantically corrupted.</p><p>That distinction matters.</p><p>An LLM does not see the original document. It only sees the text string you hand it. If that string mixes unrelated sections together or drops important content entirely, the model is not failing at reasoning. It is failing because the input no longer reflects the document’s meaning.</p><p>In an AI workflow, parsing is not preprocessing. It is the foundation.</p><h3>The PDF trap: when reading by coordinates breaks meaning</h3><p>The first major issue showed up with PDF resumes.</p><p>Modern resumes, especially for engineers and other technical candidates, often use two-column layouts. One side may contain a fit snapshot, skills, certifications, or contact details. The other contains experience, summary, and projects.</p><p>Visually, this is easy for a human to scan.</p><p>A naive parser does not see it that way.</p><p>With pdfplumber, a common pattern is calling .extract_text(). The problem is that this approach tends to read text according to positional flow rather than preserving the document’s logical block structure. In practice, text sitting at the same vertical height across two columns can get merged into a single stream.</p><p>So instead of preserving:</p><ul><li>left column: “FIT SNAPSHOT”</li><li>right column: “Professional Summary”</li></ul><p>you end up with something like:</p><p><strong>FIT SNAPSHOT Professional Summary</strong></p><p>That may seem minor, but it gets worse fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXX2jv3p-9MiNPa-MMHgYA.png" /></figure><p>Once multiple sections are interleaved, skills can blend into summaries, job titles can collide with side notes, and the LLM receives a scrambled version of the resume. At that point, any extraction agent trying to identify experience, skills, or career progression is operating on damaged context.</p><p>The output may still look polished. But the structure underneath is wrong.</p><h4>The fix: extracting logical blocks instead of flat text</h4><p>I moved from pdfplumber to <strong>PyMuPDF (</strong><strong>fitz)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62vqSJeeuCkzx0KAnD9T1w.png" /></figure><p>The reason was simple: I needed a parser that respected layout better. Instead of flattening the page into one string too early, PyMuPDF can extract text as logical blocks using page.get_text(&quot;blocks&quot;).</p><p>That was the key shift.</p><p>Rather than asking, “What text exists on this page?”, the better question became, “What text blocks exist on this page, and in what sequence should they be read?”</p><p>This gave the parser a much better chance of preserving actual reading order in multi-column resumes. It treated sections as spatial regions rather than blindly merging everything that happened to share a Y-coordinate.</p><p>For an LLM pipeline, that difference is huge. Clean block-level extraction preserves section boundaries. And once section boundaries survive, downstream structured extraction becomes dramatically more reliable.</p><h3>The DOCX trap: the content is there, but your parser never sees it</h3><p>The second issue was more subtle.</p><p>DOCX files often look easier to parse because they are structured documents rather than rendered pages. But Word introduces a different trap: content that looks like normal text to a human may be stored in tables under the hood.</p><p>This happens a lot in resumes.</p><p>Candidates use invisible borderless tables to align sections cleanly. A “Technical Skills” matrix might be visually prominent near the top of the document, but structurally it lives inside table cells, not standard paragraphs.</p><p>If you parse a DOCX the usual way with:</p><pre>document.paragraphs</pre><p>you will miss that content.</p><p>Not because the content is hidden from Word, but because it is hidden from the specific iterable you are using.</p><p>That creates a dangerous failure mode. The parser does not crash. It just silently returns an incomplete document.</p><p>And incomplete input is one of the hardest bugs to spot in LLM systems, because the model will often keep answering confidently.</p><h3>Why iterating paragraphs and tables separately still fails</h3><p>A natural reaction is to patch the parser by reading paragraphs first and then reading tables afterward.</p><p>But that creates a different problem.</p><p>Now you are no longer preserving the visual order of the original document. A skills section that appeared near the top might be appended to the end of the extracted text simply because tables were processed after paragraphs.</p><p>That breaks contextual hierarchy.</p><p>For a recruiter, the placement of information matters. A summary, skills section, recent experience, and education are interpreted partly through order and grouping. If your parser changes that sequence, you are handing the LLM a distorted version of the resume.</p><h3>The fix: crawl the underlying document structure in sequence</h3><p>The solution was to stop treating paragraphs and tables as separate content types and instead traverse the underlying XML document structure in the order elements actually appear.</p><p>That meant building a custom traversal layer that walked the DOCX nodes sequentially, handling paragraphs and tables together rather than in isolation.</p><p>The practical goal was simple: extract the document the way a recruiter’s eye would scan it.</p><p>That approach preserved both content and hierarchy. Paragraphs stayed where they belonged. Table-based sections appeared in the correct place. Invisible layout tricks stopped being invisible to the system.</p><p>For document understanding, that was the difference between “some text was extracted” and “the document was represented faithfully.”</p><h3>The architectural shift: from ingestion script to agentic node</h3><p>Once the parsing logic became robust, the next realization was architectural.</p><p>This was not just a utility script sitting before the “real” AI work.</p><p>Parsing needed to become its own node in the system.</p><p>I’m building the project as an <strong>AI-powered resume screener</strong> using <strong>LangGraph</strong>, where different nodes handle distinct responsibilities in a structured pipeline. That made it natural to elevate parsing into <strong>Node 1: Parser</strong> rather than burying it as an implementation detail.</p><p>The flow looks like this:</p><p><strong>Input: Raw file</strong><br> → <strong>Node 1: Parser</strong><br> → <strong>Node 2: Extraction </strong><br> → <strong>Node 3: Gap Analysis</strong><br> → <strong>Node 4: Recommendation</strong></p><p>The parser node now does a few critical things:</p><ul><li>validates the file extension</li><li>chooses the right parsing strategy</li><li>extracts logically ordered text</li><li>passes a clean text representation into shared state</li></ul><p>Only after that does the extraction agent operate on the content.</p><p>That separation matters a lot.</p><p>When parsing and reasoning are coupled together, failures become blurry. If output quality drops, you do not know whether the model misunderstood the document or whether the document was already corrupted before inference began.</p><p>By decoupling them, observability improves.</p><p>If the parser fails, that is a data-handling problem.<br> If the extraction agent fails on clean text, that is a reasoning problem.<br> Those are different classes of failure and should be debugged differently.</p><p>This is where “agentic” design becomes valuable beyond buzzwords. A node-based architecture makes each stage explicit, testable, and replaceable.</p><h3>What this changed in my project</h3><p>In my resume screener, the parser is no longer a thin wrapper around file reading. It is a deliberate ingestion layer built for real-world formatting.</p><p>That matters because the rest of the system depends on trustworthy text.</p><p>The downstream agents are responsible for things like:</p><ul><li>extracting structured skills and requirements</li><li>identifying skill gaps</li><li>scoring candidate-role fit</li><li>generating evidence-backed hiring recommendations</li><li>surfacing interview focus areas and red flags</li></ul><p>None of that works well if the parser has already mixed columns, dropped tables, or reordered sections.</p><p>So the parser became the first serious quality gate in the system.</p><p>Not glamorous. But essential.</p><h3>The lesson for AI engineers</h3><p>There is a common tendency in LLM projects to over-index on prompts and under-invest in input integrity.</p><p>Document workflows expose that mistake immediately.</p><p>If the semantic layout of a document does not survive parsing, your model is working with a lossy and often misleading version of reality. Better prompting might hide the problem in demos, but it will not solve it in production.</p><p>The simplest way to catch this is also the most overlooked:</p><p><strong>Read the parsed text yourself.</strong></p><p>Not the source PDF.<br> Not the DOCX in Word.<br> The actual string your model receives.</p><p>If the structure looks broken to you, it is broken for the LLM too.</p><p>That one habit can save hours of prompt tweaking and a lot of false confidence.</p><h3>Final takeaway</h3><p>The biggest parsing mistake is assuming extraction is solved because text came out.</p><p>In AI systems, text extraction is only useful if meaning survives.</p><p>That means preserving reading order, respecting layout, handling real formatting tricks, and separating ingestion failures from reasoning failures. Once I treated parsing as a proper node in the workflow instead of a throwaway script, the rest of the pipeline became easier to trust, debug, and improve.</p><p>If you are building a resume screener, a RAG system, or any document-processing application, start by validating the parser before optimizing the model.</p><p>Because when the document enters the system in the wrong shape, every downstream decision is built on a faulty foundation.</p><p>♻️ Found this useful? Share it with someone who is new to the data world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Linkedin: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR mostly.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc0781b2ab8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Agent Engineering Lifecycle: How to Move From Demo to Production]]></title>
            <link>https://medium.com/@neehanthreddym/the-agent-engineering-lifecycle-how-to-move-from-demo-to-production-0e32ef6b4725?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e32ef6b4725</guid>
            <category><![CDATA[production-design]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Thu, 19 Mar 2026 13:01:04 GMT</pubDate>
            <atom:updated>2026-03-19T13:01:04.027Z</atom:updated>
            <content:encoded><![CDATA[<p>Building an AI agent prototype is easy now.</p><p>A system prompt, a couple of tools, some orchestration logic, and you can have something impressive running in a few hours.</p><p>But that is not the hard part.</p><p>The hard part is getting an agent to work reliably in production.</p><p>That is where many teams stall. Not because the prototype is bad, but because the path from “it works in a demo” to “it holds up with real users” is a very different kind of engineering problem.</p><p>That is exactly what the <strong>Agent Engineering Lifecycle</strong> helps solve.</p><p>It gives teams a practical loop for taking an agent from an early prototype to a production system that can be observed, tested, improved, and trusted over time.</p><h3>Why this lifecycle matters</h3><p>Most agent failures do not show up during the first happy-path demo.</p><p>They show up later:</p><ul><li>when the model chooses the wrong tool</li><li>when the agent makes a strange decision you cannot explain</li><li>when a small prompt change breaks a previously working workflow</li><li>when real users ask questions no one anticipated</li><li>when you suddenly have too many traces to inspect manually</li></ul><p>The Agent Engineering Lifecycle is useful because it treats agent development as an <strong>iterative reliability process</strong>, not a one-time build task.</p><p>Instead of asking, “Can we build an agent?”</p><p>It asks, “Can we understand it, test it, deploy it safely, and keep improving it after launch?”</p><h3>The lifecycle at a glance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Yths8cS7rm2xGe1HLOE3g.png" /></figure><p>The lifecycle has six stages:</p><ol><li><strong>Build</strong></li><li><strong>Observe (Pre-Production)</strong></li><li><strong>Offline Evals</strong></li><li><strong>Deploy</strong></li><li><strong>Observe (In Production)</strong></li><li><strong>Online Evals</strong></li></ol><p>These stages form two connected loops:</p><ul><li>a <strong>testing loop</strong> for development</li><li>a <strong>validation loop</strong> for production</li></ul><p>The key idea is simple: this is not a straight line. It is a cycle that keeps repeating as your agent evolves.</p><h3>1. Build: Start with a working agent</h3><p>Everything begins with an agent that can run.</p><p>That could be a customer support bot, a research assistant, or a coding agent. At this point, it usually has:</p><ul><li>a system prompt</li><li>access to tools</li><li>some orchestration or control flow</li></ul><p>This stage is about having something functional enough to evaluate.</p><p>What matters here is not perfection. What matters is that you have a system you can start learning from.</p><p>A lot of teams over-focus on this stage. They keep tweaking prompts, adding tools, or restructuring flows before they have enough visibility into what is actually going wrong.</p><p>But build is only the entry point.</p><h3>2. Observe in pre-production: Make the agent visible</h3><p>Once the agent runs, the next problem appears quickly:</p><p>It fails, but you do not know why.</p><p>You get a poor output, but no explanation. Was the prompt wrong? Did it pick the wrong tool? Did the model misunderstand context? Did orchestration behave unexpectedly?</p><p>This is why <strong>observation</strong> is the highest-leverage activity early in agent development.</p><p>In pre-production, observation means <strong>tracing</strong> the agent’s behavior in detail:</p><ul><li>every LLM call</li><li>every tool invocation</li><li>every intermediate decision</li><li>every step in the execution path</li></ul><p>That visibility changes everything.</p><p>Instead of guessing, you can inspect what happened. You can run scenarios, read traces, identify failure patterns, and debug with evidence.</p><p>This stage is manual and hands-on. You are actively testing queries, reviewing traces, and spotting issues yourself.</p><p>That manual work is not a bottleneck at this stage. It is the fastest way to learn.</p><h4>Why this stage has such high ROI</h4><p>Early in development, one good trace can uncover more than hours of blind prompt iteration.</p><p>You stop asking:</p><ul><li>“Why is the agent weird sometimes?”</li></ul><p>And start asking:</p><ul><li>“Why did it call this tool here?”</li><li>“Why did it ignore that instruction?”</li><li>“Why did this decision branch happen?”</li><li>“What exact step caused the bad final answer?”</li></ul><p>That shift is what makes agent engineering feel like engineering instead of trial and error.</p><h3>3. Offline evals: Turn manual learnings into automated tests</h3><p>Manual observation helps you find and fix your first failures.</p><p>But once you start changing prompts, tools, or workflows, a new problem shows up: you cannot manually rerun everything every time.</p><p>This is where <strong>offline evals</strong> become essential.</p><p>Offline evals are automated evaluations run on a dataset of inputs and expected behaviors. Their job is to answer questions like:</p><ul><li>Did the latest change improve the agent?</li><li>Did it break something that used to work?</li><li>Are we getting better over time or just moving failures around?</li></ul><p>These evals give you two things that manual testing cannot provide consistently:</p><p><strong>1. Regression detection</strong></p><p>A fix for one failure can quietly introduce another.</p><p>Offline evals help catch that before deployment.</p><p><strong>2. Progress tracking</strong></p><p>You need a way to measure whether the agent is actually improving across a representative set of tasks.</p><p>Without that, development becomes anecdotal. One or two examples may look better, while the broader system gets worse.</p><h4>A practical way to think about offline evals</h4><p>Manual observation helps you discover failure modes.</p><p>Offline evals help you <strong>institutionalize</strong> those learnings.</p><p>Every meaningful failure you find manually can become a future test case.</p><p>That is how the agent becomes more robust over time: not by hoping the same bug does not happen again, but by encoding what you learned into repeatable evaluation.</p><h3>4. Deploy: Put the agent in front of real users</h3><p>When your agent is passing offline evals, it is ready for exposure to the real world.</p><p>That does not mean global scale on day one. It often means:</p><ul><li>beta testers</li><li>internal dogfooding</li><li>early adopters</li><li>limited rollout</li></ul><p>This stage matters because real users do what test datasets cannot fully simulate.</p><p>They bring:</p><ul><li>unexpected queries</li><li>ambiguous phrasing</li><li>novel edge cases</li><li>different usage patterns</li><li>stress on parts of the system you did not know were fragile</li></ul><p>Deployment is not the finish line. It is the start of a new kind of learning.</p><p>In practice, real usage reveals whether your development assumptions were too narrow.</p><h3>5. Observe in production: Find signal at scale</h3><p>Pre-production observation is manual and deep.</p><p>Production observation is different.</p><p>Once real users are involved, the volume increases fast. You may have hundreds or thousands of traces. At that point, reviewing everything manually is no longer realistic.</p><p>So the question changes.</p><p>It is no longer just, “Can we inspect this trace?”</p><p>It becomes, “How do we systematically surface the traces that matter most?”</p><p>Production observation is about identifying patterns:</p><ul><li>where users are struggling</li><li>which queries frequently fail</li><li>what kinds of behavior are becoming common</li><li>where the agent is degrading under real usage</li></ul><p>This stage helps you move from isolated debugging to operational awareness.</p><p>You are not just looking at what the agent did once. You are trying to understand how it behaves across a population of users and over time.</p><p>That shift is critical. Reliability at scale is not about reading every trace. It is about building a system that helps you prioritize attention.</p><h3>6. Online evals: Evaluate production behavior continuously</h3><p>The final stage is <strong>online evals</strong>.</p><p>These are evaluations that run automatically on production traces as they come in.</p><p>This is where reliability becomes continuous rather than occasional.</p><p>Online evals can support:</p><ul><li>dashboards that show quality over time</li><li>automated monitoring of key behaviors</li><li>routing traces for human review when something looks off</li></ul><p>This matters because production systems drift.</p><p>User behavior changes. Query distributions change. New edge cases emerge. Even if your agent performed well last week, that does not guarantee it is healthy today.</p><p>Online evals help teams keep a live view of performance instead of relying only on periodic manual reviews.</p><h3>The two loops inside the lifecycle</h3><p>One of the most useful ideas in this lifecycle is that it really contains <strong>two loops</strong>.</p><h4>The testing loop</h4><p><strong>Build → Observe → Offline Evals</strong></p><p>This is where most development time is spent.</p><p>You build something, inspect how it behaves, discover failures, and convert what you learn into automated checks. Then you improve the agent and repeat.</p><p>This loop is where quality gets built.</p><h4>The validation loop</h4><p><strong>Deploy → Observe → Online Evals</strong></p><p>This loop begins once the agent is in front of real users.</p><p>You deploy, observe what happens in production, evaluate live traces, and feed those learnings back into the next round of improvements.</p><p>This loop is where quality gets validated in the real world.</p><p>Together, these loops create a practical operating model for agent systems.</p><h3>What makes this lifecycle different from traditional software workflows</h3><p>Traditional software engineering already has concepts like testing, deployment, monitoring, and iteration.</p><p>So what is different here?</p><p>The biggest difference is that agents are not fully deterministic systems.</p><p>Their behavior depends on model outputs, tool use, context interpretation, and multi-step decision-making. That means failures are often less obvious and less reproducible than standard application bugs.</p><p>Because of that, <strong>observability and evaluation become first-class engineering tools</strong>, not optional extras.</p><p>You are not just testing whether code runs.</p><p>You are testing whether the agent behaves well across ambiguity, variation, and real-world complexity.</p><h3>A useful mindset for teams building agents</h3><p>A strong way to approach agent work is this:</p><p>Do not treat reliability as something you add after the prototype.</p><p>Treat it as the actual engineering discipline.</p><p>The prototype proves possibility.</p><p>The lifecycle builds trust.</p><p>That is the difference between a cool demo and a system people can depend on.</p><h3>Final takeaway</h3><p>The Agent Engineering Lifecycle is valuable because it gives teams a realistic path from experimentation to production reliability.</p><p>It starts with a working agent, but it does not stop there.</p><blockquote>You observe what the agent is doing.<br> You test it systematically.<br> You deploy carefully.<br> You monitor it in the real world.<br> You evaluate behavior continuously.<br> And then you use all of that learning to improve the next version.</blockquote><p>That cycle never really ends.</p><p>And that is the point.</p><p>Reliable agents are not built in one shot. They are engineered through repeated loops of visibility, testing, deployment, and feedback.</p><p>If your team is stuck between “it works” and “we trust it,” this lifecycle is the bridge.</p><p>♻️ Found this useful? Share it with someone who is new to the data world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Linkedin: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR mostly.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e32ef6b4725" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenDev: The Open Source Blueprint for Terminal AI Coding Agents]]></title>
            <link>https://medium.com/@neehanthreddym/opendev-the-open-source-blueprint-for-terminal-ai-coding-agents-9c509709fe8e?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c509709fe8e</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai-agent-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Sun, 15 Mar 2026 20:08:13 GMT</pubDate>
            <atom:updated>2026-03-15T20:08:13.090Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K6ya06MvPMAGgmxcVD33XA.png" /></figure><p>There is a quiet shift happening in how developers interact with AI. For years, coding assistants lived inside your IDE — they waited, they suggested, they completed. Reactive and scoped.</p><p>That model is being replaced by the terminal native autonomous agent: something you point at a problem, walk away from, and return to a solution. Claude Code started this shift. OpenDev is the open source answer to it and it comes with something rare: an 80 page technical paper explaining every design decision, including the ones that failed first.</p><p>This post covers what the paper reveals about the engineering reality of building autonomous coding agents that actually hold up in long sessions.</p><p>The research paper: <a href="https://arxiv.org/pdf/2603.05344">Building Effective AI Coding Agents for the Terminal</a></p><h3>OpenDev vs Claude Code: The Core Tradeoff</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wn5PviSX-VUWKKVtCcM8yQ.png" /></figure><p><strong>Choose OpenDev if</strong> you want to run a self hosted agent, experiment with different models and routing policies, or study a fully documented reference architecture for CLI agents.</p><p><strong>Choose Claude Code if</strong> you want something that deeply understands your repo, runs tests, creates PRs, and integrates with GitHub and your IDE with minimal setup.</p><p>The rest of this post is about what makes OpenDev’s architecture interesting regardless of which tool you use.</p><h3>The Core Insight: One Model Is Not Enough</h3><p>OpenDev is built as a <strong>compound AI system</strong> — not a single LLM, but a structured ensemble of agents and workflows, each independently bound to a model of your choice.</p><p>Work is organized into a four level hierarchy: <strong>session → agent → workflow → LLM</strong>. Five workflow slots each bind to their own model:</p><p><strong>Action</strong> — the primary execution model for tool calls and coding tasks.</p><p><strong>Thinking</strong> — a separate model for extended reasoning with no tool access. The key insight: when tool schemas are present in an API call, models tend to act quickly rather than think deeply. Removing the schemas from the thinking call changes behavior through structure, not instruction.</p><p><strong>Critique</strong> — evaluates and refines the thinking model’s output. Used selectively rather than on every turn because running it on every output proved too slow for routine tasks.</p><p><strong>Compact</strong> — a smaller, faster, cheaper model for summarizing old conversation history. You do not need Claude Opus to compress old tool outputs.</p><p><strong>Vision</strong> — handles screenshots and images for visual debugging.</p><p>You can run Claude for execution, GPT o3 for reasoning, and a lightweight open weight model for compaction — all in the same session, switched with a config change:</p><pre>{<br>  &quot;model_provider&quot;: &quot;anthropic&quot;,<br>  &quot;model&quot;: &quot;claude-sonnet-4-20250514&quot;,<br>  &quot;model_thinking_provider&quot;: &quot;openai&quot;,<br>  &quot;model_thinking&quot;: &quot;o3&quot;<br>}</pre><h3>The Extended ReAct Loop</h3><p>Standard ReAct interleaves reasoning and action in the same turn. The problem: tool schemas create pressure to act before thinking. OpenDev adds explicit phases around the standard Reason Act Observe cycle:</p><p><strong>Phase 0: Context Management</strong> — check token pressure, apply reduction if needed.</p><p><strong>Phase 1: Thinking</strong> — a separate LLM call with no tool schemas. The model reasons about the situation without the option of reaching for a tool. Four depth levels: OFF, LOW, MEDIUM, HIGH. At HIGH, a critique model evaluates the reasoning trace before the thinking model refines it.</p><p><strong>Phase 2: Action</strong> — the action model receives the full conversation including the injected thinking trace and all tool schemas, and returns a response.</p><p><strong>Phase 3: Decision and Dispatch</strong> — tool calls are executed. Reads run in parallel via a thread pool; writes run sequentially. A doom loop detector fingerprints each tool call as an MD5 hash of the tool name and arguments. If the same fingerprint appears three or more times in a sliding window of 20 recent calls, the system injects a warning and skips execution. If it recurs after the warning, it pauses for user approval. The paper notes this is more robust than iteration caps because a model can ignore injected text but cannot bypass a genuine execution halt.</p><h3>Context Engineering: The Actual Hard Problem</h3><p>The paper makes a strong claim: <strong>context management is not a secondary optimization. It is the primary engineering challenge for any long running agent.</strong></p><p>Tool outputs routinely consume 70 to 80 percent of the context window in a typical session.</p><h4>Dynamic System Prompts</h4><p>Instead of one monolithic prompt, OpenDev assembles the system prompt at runtime from independent markdown sections with condition predicates. Git workflow rules only load if you are inside a Git repository. Task tracking instructions only load if the feature is enabled. Irrelevant sections never touch the context window.</p><p>For Anthropic’s API, the stable 80 to 90 percent of the prompt receives a cache control header. Since the system prompt is resent on every LLM call, caching the stable portion yields roughly 88 percent cost reduction on that portion across a multi turn session.</p><h4>Adaptive Context Compaction</h4><p>Five graduated pressure stages rather than one emergency threshold:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKRKdWucimOOrhTMfb5yWA.png" /></figure><p>The fast pruning pass at 85% is a cheap deletion operation that often reclaims enough space to avoid the expensive LLM summarization entirely.</p><p>One specific finding worth noting: always calibrate against the API’s reported prompt_tokens count, not a local estimate. Providers inject invisible content — safety preambles, tool schema serializations — that makes local token counting systematically underestimate actual usage. In OpenDev’s case this discrepancy caused compaction to trigger too late, leading to context overflow errors.</p><h4>Context Aware System Reminders</h4><p>After 15 to 20 tool calls, models reliably stop following instructions they received at the start of the conversation. The rules are still in the context window but their influence fades with distance. The paper observed this as a predictable, reproducible failure mode in every session exceeding 15 tool calls.</p><p>The fix is not re injecting the full system prompt. That wastes tokens on instructions the agent does not currently need.</p><p>OpenDev injects short, single purpose messages as <strong>role: user</strong> messages, at maximum recency, exactly at the decision point where the agent would otherwise go wrong. User role reminders produce stronger compliance than system role reminders because the model treats them as something that just happened rather than background instruction.</p><p>Eight event detectors monitor the conversation state after each tool execution: tool failure without retry, exploration spirals (five or more consecutive reads), premature completion with incomplete tasks, and others. Guardrail counters prevent any single reminder from firing more than a configured number of times so they do not become noise the model learns to ignore.</p><h4>Dual Memory Architecture</h4><p>For long sessions, the thinking model gets two types of context: an <strong>episodic memory</strong> (a periodically regenerated LLM summary of the full history capturing decisions, goals, and key file paths) and a <strong>working memory</strong> (verbatim reproduction of the last several exchanges preserving exact error messages and line numbers for immediate use).</p><p>A subtle but important detail: iteratively summarizing a summary accumulates distortion. The system regenerates the episodic summary from the full conversation history every five messages rather than compressing the previous summary. Fresh compression prevents drift.</p><h3>Tool Design: Built for Imprecision</h3><h4>The 9 Pass Fuzzy Edit Tool</h4><p>LLMs frequently reproduce old file content with slight drift: trailing whitespace, indentation differences, escape sequence variations. A strict exact match tool fails on these cases and enters error recovery loops that consume context without making progress.</p><p>OpenDev chains nine progressively relaxed matchers:</p><p>Simple exact → line trimmed → block anchor → whitespace normalized → indentation flexible → escape normalized → trimmed boundary → context aware anchor → multi occurrence last resort</p><p>The chain short circuits on the first match so exact matches incur zero overhead. Each matcher returns the actual substring found in the file, not the LLM’s version, so the replacement preserves the original formatting. The paper describes this as the single largest source of edit failures before it was built.</p><h4>Lazy MCP Tool Discovery</h4><p>Loading all external tool schemas at startup consumed 40 percent of the context budget before the agent processed its first message. OpenDev uses lazy discovery: the agent gets a compact metadata index at startup. Full schemas are only loaded when the agent actively searches for and selects a tool. Baseline MCP overhead drops from 40 percent to under 5 percent.</p><h3>Safety Architecture: Five Independent Layers</h3><p><strong>Layer 1 — Prompt Level Guardrails:</strong> Security policy, action safety rules, git workflow constraints, error recovery guidance.</p><p><strong>Layer 2 — Schema Level Tool Restrictions:</strong> Write tools are absent from plan mode and subagent schemas. Not gated — absent. A model that never sees a tool in its schema cannot attempt to invoke it, argue for an exception, or probe for bypass conditions. This is more robust than any runtime check.</p><p><strong>Layer 3 — Runtime Approval System:</strong> Three autonomy levels (Manual, Semi Auto, Auto). Default danger patterns like rm -rf / and chmod 777 are always active and cannot be overridden.</p><p><strong>Layer 4 — Tool Level Validation:</strong> Stale read tracking prevents overwriting files modified since the agent’s last read. Output truncation prevents context overflow.</p><p><strong>Layer 5 — Lifecycle Hooks:</strong> External scripts that can block tool calls (exit code 2), mutate tool arguments, or override approval decisions. Project scoped and user global hooks merge so organization wide policies can combine with repository specific rules.</p><h3>Five Lessons That Transfer to Any Agent System</h3><p>The paper closes with transferable lessons worth repeating for anyone building or evaluating agentic systems:</p><p><strong>Context is a budget, not a buffer.</strong> Graduate your reduction strategies. Offload large tool outputs to the filesystem and return a reference instead. Retrieval costs one tool call; context consumption is paid on every LLM invocation for the rest of the session.</p><p><strong>Inject reminders at the point of decision, not upfront.</strong> System prompt instructions fade with distance. Short targeted user role messages injected at the decision point produce stronger compliance. Cap each reminder type so it does not become noise.</p><p><strong>Separate thinking from action through API call design, not instruction.</strong> Removing tool schemas from the thinking call changes behavior. Asking the model to “think carefully” while tools are present does not.</p><p><strong>Make unsafe tools invisible, not blocked.</strong> Schema gating is more robust than runtime permission checks. Layers that fail independently are more reliable than a single hardened gate.</p><p><strong>Design tools to absorb imprecision.</strong> The LLM’s intent is usually correct even when its literal output is not. Build matchers, error recovery, and contextual hints that bridge the gap rather than reject near misses.</p><p>OpenDev’s biggest contribution may be the documentation itself. Most production CLI agents are closed source with no published rationale. OpenDev explains what was built, why, what failed, and what specific constants emerged from iterative failure analysis. For anyone building agentic systems, that transparency is the rare thing.</p><p><strong>Research paper:</strong> <a href="https://arxiv.org/pdf/2603.05344">Building Effective AI Coding Agents for the Terminal — arXiv:2603.05344</a></p><p><strong>GitHub:</strong> <a href="https://github.com/opendev-to/opendev">github.com/opendev-to/opendev</a></p><p>♻️ Found this useful? Share it with someone who is new to the data world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Linkedin: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes — TL;DR mostly.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c509709fe8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The World of Data Explained: Roles, Tools, and the Modern Data Stack]]></title>
            <link>https://medium.com/@neehanthreddym/the-world-of-data-explained-roles-tools-and-the-modern-data-stack-5af33f2f7fcc?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5af33f2f7fcc</guid>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Fri, 13 Mar 2026 00:52:03 GMT</pubDate>
            <atom:updated>2026-03-13T00:52:03.842Z</atom:updated>
            <content:encoded><![CDATA[<p>By <a href="https://www.youtube.com/@DataWithBaraa">Data with Baraa</a></p><blockquote><em>“Without data, you are just another person with an opinion.”</em> — W. Edwards Deming</blockquote><p>If you are new to the data world, the buzzwords come fast: pipelines, ETL, data warehouses, LLMs, AI agents. This post cuts through the noise and maps out how it all fits together, from the first business question to an AI system that answers it automatically.</p><h3>The Core Problem Every Business Has</h3><p>Managers need to make fast, smart decisions. Which region is underperforming? Why are profits dropping? Without data, they guess. The entire data field exists to replace guessing with knowing.</p><h3>The Six Roles of a Modern Data Team</h3><p><strong>Data Analyst</strong> — The bridge between raw data and business decisions. They query databases using SQL, clean data in Excel, and communicate findings through visual reports in Power BI or Tableau.</p><p><strong>Data Architect</strong> — Designs the blueprint of the data system before anyone builds anything. They decide how data flows and how it is organized, often using a layered framework like the Medallion Architecture: Bronze (raw), Silver (clean), Gold (business-ready).</p><p><strong>Data Engineer</strong> — Builds the automated pipelines that move data through those layers every day. Python and SQL are their primary tools. Because of them, the analyst never has to pull data manually again.</p><p><strong>BI Developer</strong> — Takes the analyst’s reports and makes them scalable. Builds a secure reporting server so dashboards refresh automatically and anyone with access can view live data from their browser or phone.</p><p><strong>Data Scientist</strong> — Answers questions about the future. They collect large volumes of data, engineer meaningful features from it, train machine learning models, and deliver predictions — like which customers are likely to churn next month.</p><p><strong>ML Engineer</strong> — Takes the data scientist’s trained model out of a notebook and deploys it to a production server that runs 24/7, connects to other apps via APIs, and updates as new data arrives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*sHHGLBQI7hpUkDGQQdNwWg.png" /><figcaption>Image credits: ChatGPT</figcaption></figure><p>The pattern to notice: each analytical role has an engineering counterpart. One discovers and designs, the other builds and scales.</p><h3>The Essential Tools</h3><p><strong>SQL</strong> is the universal language for talking to databases. It appears in virtually every data job description and is supported by every major data platform. It is the single most important skill to learn first.</p><p><strong>Python</strong> is the programming language of data pipelines, machine learning, and AI engineering. Simple to read, but endlessly powerful.</p><p><strong>Power BI and Tableau</strong> are the two dominant BI platforms. Power BI is more affordable, deeply integrated with Microsoft products, and ideal for standard business reporting. Tableau handles more complex visualizations and large datasets better. Both are worth knowing, and many teams use both.</p><h3>How Data Gets Organized: The Medallion Architecture</h3><p>The most widely adopted framework for structuring a modern data system organizes everything into three layers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*3a1Kx8SMjDUebF9udGXF5A.png" /><figcaption>Image credits: ChatGPT</figcaption></figure><p>Data flows upward through each layer, getting progressively more useful. By the time an analyst or AI system touches the Gold layer, everything is already prepared.</p><h3>What AI Changes — and What It Does Not</h3><p>We are now in the era of pre-trained Large Language Models (LLMs) like GPT-4 and Claude. They understand language and context out of the box. You do not train them from scratch — you connect them to your data and use them.</p><p>For companies with proprietary data, two approaches make LLMs company-aware:</p><p><strong>Fine-tuning</strong> — train a pre-trained model further using the company’s own data so it understands the specific domain.</p><p><strong>RAG (Retrieval Augmented Generation)</strong> — at query time, retrieve relevant company documents from a vector database and pass them to the model as context. No retraining required.</p><p><strong>AI Agents</strong> take things further still. Rather than just answering questions, an agent takes action — querying a database, sending an email, triggering a workflow. Multiple specialist agents can be orchestrated together, managed by a supervisor agent that routes each request to the right place.</p><p><strong>MCP (Model Context Protocol)</strong> is the emerging standard that makes agent-to-system connections safe and reusable, eliminating the need to build a custom connector for every integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*SqIn0EoUzUCBsDAla1rz4Q.png" /><figcaption>Image credits: ChatGPT</figcaption></figure><h3>Key Takeaways</h3><p>SQL is non-negotiable regardless of which data role you pursue. Python handles everything SQL cannot. The Medallion Architecture is the clearest mental model for how modern data systems are organized. LLMs have not replaced data scientists — they have given them more powerful tools and more work to do. And AI agents mark the shift from AI that answers questions to AI that gets work done.</p><p>Whether you are entering the field or trying to understand how your company’s data team operates, this is the map.</p><p>Found this useful? Share it with someone who is new to the data world.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Linkedin: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>Subscribe <a href="https://aideck.substack.com/">here</a> for weekly newsletter, short notes – TL;DR mostly.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5af33f2f7fcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI System Design in 2026: A Complete Engineer’s Guide to Building Scalable, Intelligent Systems]]></title>
            <link>https://medium.com/@neehanthreddym/ai-system-design-in-2026-a-complete-engineers-guide-to-building-scalable-intelligent-systems-653d11299550?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/653d11299550</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[trending]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 13:01:02 GMT</pubDate>
            <atom:updated>2026-03-10T13:01:02.403Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By The </em><a href="https://www.systemdesignhandbook.com/guides/ai-system-design/"><em>System Design Handbook</em></a><em> Team</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UxMW59e-ASqCzIE9dH2A_Q.png" /></figure><p>Artificial intelligence is no longer a niche component bolted onto the side of a product. In 2026, it is structural. From recommendation engines that drive revenue to autonomous agent workflows that replace entire human task queues, AI sits at the center of how modern systems operate.</p><p>That shift has profound implications for engineers. If you are preparing for a system design interview, building a production ML platform, or simply trying to understand how large-scale AI actually works, the ability to reason clearly about AI architecture has become a baseline expectation rather than a differentiator.</p><p>This guide walks you through the complete landscape of AI system design: how data moves, how models are trained and deployed, how agents reason and act, and how to make smart trade-offs when every decision has a cost.</p><h3>What Makes AI System Design Different</h3><p>Traditional system design focuses on moving data reliably, scaling services horizontally, and keeping latency low. AI system design inherits all of those concerns and layers on several more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*rwc0BAfA2TwAETu3R8RrQw.png" /></figure><p>An AI system does not just store and serve data. It learns from data, makes predictions, and in agentic settings, takes actions in the world. That introduces challenges that have no direct analog in conventional backend architecture: training pipelines that process massive datasets on GPU clusters, feature stores that must serve identical data to both offline training and online inference, model versioning and rollback strategies, feedback loops that route real-world outcomes back into retraining pipelines, and agents that chain tool calls, reason across steps, and maintain memory across sessions.</p><blockquote><strong><em>Interview Tip:</em></strong><em> In 2026 interviews, distinguish between Predictive AI (classification, ranking, regression) and Generative or Agentic AI (content creation, autonomous task execution). The architectural constraints around latency, cost, and context management differ significantly between the two.</em></blockquote><h3>Defining the Problem Space First</h3><p>Before drawing a single architecture box, you need to define the problem. This is true of all system design, but in AI systems the scoping decisions cascade much further downstream.</p><p>For any AI design problem, the key questions to clarify are: what data types are involved, what is the latency budget, how frequently does the model need to retrain, how does user or system feedback get incorporated, and for LLM-based systems, what is the context window limit and does the system require long-term memory across sessions.</p><p>These answers define both your functional requirements and your non-functional requirements. Skipping this step in an interview is the single most common mistake.</p><h3>The Core Objectives of a Production AI System</h3><p>Every production AI system must balance five fundamental objectives. Understanding the tension between them is what separates junior thinking from senior thinking.</p><ul><li><strong>Accuracy</strong> means the system produces reliable predictions. For generative models, this also means minimizing hallucinations and unsafe outputs. Accuracy is not just a metric; it is a trust signal for the business and the user.</li><li><strong>Scalability</strong> means the system handles growing datasets and increasing request volume. This typically requires distributed training across GPU clusters, horizontal scaling of inference services, and data sharding strategies that eliminate single-node bottlenecks.</li><li><strong>Latency</strong> means predictions arrive fast enough to be useful. For a ranking system this might mean p99 latency under 200 milliseconds. For an LLM interface it might mean streaming the first token within 300 milliseconds. Define the target explicitly and design backward from it.</li><li><strong>Adaptability</strong> means models improve over time. This requires feedback loops that route real-world outcomes back into training pipelines, and infrastructure that makes retraining and redeployment routine rather than heroic.</li><li><strong>Observability</strong> means you can see what the system is doing. Logging, monitoring, drift detection, and auditability must be first-class design concerns, not afterthoughts.</li></ul><h3>High-Level Architecture: The Three Layers</h3><p>A robust AI system organizes into three primary layers. In advanced agentic systems, a fourth orchestration layer manages multi-agent workflows and tool use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*YkfxVcrcnV_z73UfzhiNdQ.png" /></figure><p><strong>The Data Layer</strong> handles everything before a model touches a data point. It ingests streams from sources like Kafka, runs preprocessing pipelines that clean and normalize inputs, and operates a feature store that serves consistent, versioned features to both training jobs and real-time inference requests. The feature store is the single most important component for preventing training-serving skew, which is the situation where the features your model was trained on differ from the features it sees in production. This mismatch is one of the most common causes of unexplained model degradation in live systems.</p><p><strong>The Model Layer</strong> handles training, evaluation, and lifecycle management. Training jobs run on GPU or TPU clusters using frameworks like PyTorch, TensorFlow, or JAX. Distributed training strategies allow training to scale beyond what a single machine can handle. Once trained, a model goes into a model registry alongside its metadata, hyperparameters, evaluation metrics, and lineage. This is what enables safe rollback when a new version underperforms and provides the audit trail compliance teams require.</p><p><strong>The Serving Layer</strong> hosts trained models and handles real-time inference requests. It exposes APIs, manages load balancing across model replicas, implements caching to avoid redundant computation, and routes requests through inference engines like TensorFlow Serving, ONNX Runtime, or vLLM for LLM workloads. In agentic systems, it also implements orchestration logic: routing requests to the appropriate agent, managing tool calls, and coordinating results from multiple specialized workers.</p><blockquote><strong><em>Watch Out:</em></strong><em> Training-serving skew occurs when the code or logic used to compute features during training differs from what runs during real-time inference. Always use a unified feature store with versioning to prevent this. It is a silent killer of model performance in production.</em></blockquote><h3>Offline vs. Online Pipelines</h3><p>AI systems almost always operate two parallel worlds: an offline world optimized for throughput and quality, and an online world optimized for latency.</p><p>Offline pipelines train models on large historical datasets at regular intervals, compute expensive features like matrix factorizations or dense document embeddings, and push results into the feature store for consistent downstream consumption. Throughput and model quality are prioritized over immediacy.</p><p>Online pipelines serve predictions from pre-trained models with minimal latency, update feature values dynamically as users take actions, and power experiences like instant search suggestions or personalized content feeds. Every millisecond matters.</p><p>In a typeahead system, for example, the offline pipeline builds prefix indexes from the full query log. The online system then queries those indexes from a cache and returns suggestions within single-digit milliseconds.</p><blockquote><strong><em>Architecture Tip:</em></strong><em> Use batch-stream hybrid architectures, often described as Lambda or Kappa-style, to merge historical depth with real-time freshness. This gives your model access to long-run patterns while still reacting to what the user just did.</em></blockquote><h3>Agentic AI and Multi-Agent Patterns</h3><p>The most significant architectural shift in 2026 is the rise of agentic AI. Where traditional systems produce a prediction and stop, agentic systems reason, plan, use tools, and take actions across multiple steps.</p><p>The dominant pattern is orchestrator-worker. A central Orchestrator LLM receives a complex user query, decomposes it into subtasks, and delegates each to a specialized Worker agent. Workers might include a code execution agent, a web search agent, a database query agent, and a summarization agent. The orchestrator collects results and synthesizes a final response. This separation of responsibilities allows each agent to specialize without the orchestrator needing to understand every domain. It also makes the system easier to test, extend, and debug.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*un8NRyTxf2lXEi2fbkUVtg.gif" /></figure><p>Agents use structured reasoning workflows to improve reliability. The ReAct (Reason-Act) pattern asks the model to reason about what to do before taking an action, then observe the result before reasoning again. For harder problems, Tree-of-Thought and Graph-of-Thought patterns explore multiple reasoning paths, critique their own outputs, and select the strongest path forward.</p><p>Unlike stateless REST APIs, agents need memory. A well-designed agentic system includes short-term memory for tracking the current session context, and long-term memory backed by a vector database to recall user preferences, past interactions, and domain knowledge accumulated over weeks or months.</p><p>The Model Context Protocol (MCP) is an emerging standard for managing how context and tool access are structured in agentic systems. It defines how agents discover available tools, how context windows are managed, and how results are formatted for downstream consumption.</p><h3>Caching, Indexing, and Retrieval</h3><p>Caching appears at multiple points in an AI system’s inference path. A feature cache stores computed features for reuse across requests. A model cache keeps model weights resident in GPU memory to eliminate cold start overhead. A prediction cache stores outputs for common queries to skip inference entirely.</p><p>The most powerful form is semantic caching. Rather than requiring exact query matches, the system embeds incoming queries and searches a vector store for semantically similar past requests. A query for “shoe store near me” and “footwear shop downtown” might resolve to the same cached response, saving significant GPU compute.</p><p>Different query patterns call for different index types. Vector indexes stored in systems like Pinecone or Milvus enable semantic similarity search using approximate nearest-neighbor algorithms like HNSW. Inverted indexes handle keyword-based retrieval efficiently. Tree-based structures support fast prefix lookup in autocomplete and typeahead scenarios.</p><p>In retrieval-augmented generation (RAG) systems, the retrieval layer fetches relevant documents from a vector database before passing them as context to the generation model. The quality of the index directly determines the quality of the final output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*vfv11Liena1R7-KC97Ec0w.gif" /><figcaption>General RAG architecture</figcaption></figure><h3>Scalability Patterns</h3><p>As data volumes and request rates grow, the architecture must scale without proportional increases in latency. Data sharding partitions datasets across nodes so no single machine becomes a bottleneck. Distributed training spreads model computation across GPU clusters using data or model parallelism. Model compression reduces memory and inference cost through quantization, such as converting FP16 weights to INT8. Load balancing distributes inference traffic across replicas to maintain consistent response times. Request batching groups multiple inference requests together, improving GPU utilization without adding perceptible latency.</p><p>For agentic systems specifically, independent subtasks within a workflow should be parallelized wherever possible. Running agents in parallel rather than sequentially dramatically reduces end-to-end wall-clock time for complex multi-step tasks.</p><h3>Deployment, Fault Tolerance, and Reliability</h3><p>Releasing new model versions requires care. Canary deployment rolls out the new model to a small subset of traffic first, letting engineers observe behavior at scale before full release. Shadow deployment runs the new model in parallel with the existing one on live traffic, comparing outputs without affecting users. A/B testing routes traffic to multiple model variants and uses business metrics to determine which version wins.</p><p>AI systems must remain resilient to infrastructure failures, GPU errors, and data anomalies. Key patterns include service replication across multiple nodes, retry logic for transient inference failures, circuit breakers that isolate failing components before they cause cascading outages, and fallback models that automatically serve a smaller, faster model when the primary model times out.</p><blockquote><strong><em>Design Pattern:</em></strong><em> Always implement a fallback model. If a large frontier-class model is unavailable or exceeds its latency budget, automatically route to a smaller 7 to 8 billion parameter model. Users receive a slightly less nuanced response rather than an error, which is almost always the right trade-off.</em></blockquote><h3>Monitoring and Observability</h3><p>Monitoring an AI system goes far beyond watching uptime. You need insight into model accuracy, data integrity, and behavioral drift to catch degradation before users notice it. Key metrics to track include latency at p95 and p99 percentiles, throughput measured as requests per second, model accuracy and recall through held-out evaluation sets, feature and data drift to detect when input distributions shift away from training conditions, and prediction distribution drift to catch when model outputs begin to change without corresponding input changes.</p><p>Standard observability stacks for AI systems include Prometheus and Grafana for infrastructure and latency metrics, Evidently AI for model drift monitoring, and the ELK stack for log aggregation and debugging.</p><h3>Privacy, Compliance, and Security</h3><p>AI systems that process user data carry legal and ethical obligations that must be designed in from the start. On the privacy side, this means anonymizing or pseudonymizing sensitive data before it enters training pipelines, encrypting data at rest and in transit, and honoring compliance obligations under GDPR and CCPA. The right to be forgotten requires the ability to delete a user’s data from training sets, which is a non-trivial engineering problem that requires deliberate design.</p><p>On the security side, AI systems face threats beyond those in traditional services. Data poisoning attacks corrupt training data to manipulate model behavior. Model inversion attacks attempt to reconstruct training data from model outputs. Prompt injection attacks insert malicious instructions into inputs to override system behavior. Mitigations include strict input validation, differential privacy techniques during training, and role-based access control on all APIs and model endpoints.</p><h3>Trade-offs Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2pvcYEm5bvsylkv_UVbRw.png" /></figure><h3>Practical Example: A Personalized Recommendation Engine</h3><p>Imagine designing a real-time product recommendation system for an e-commerce platform serving 100 million users.</p><p><strong>Step 1: Define Requirements.</strong> Recommendations must be personalized based on click and purchase history. Predictions must be served under 200 milliseconds. The model must update as user behavior changes within a session, not just overnight.</p><p><strong>Step 2: Design the Architecture.</strong> Kafka streams clickstream and purchase events in real time. Raw logs persist in S3 while user profiles and interaction histories live in Cassandra. A Two-Tower architecture handles candidate retrieval and XGBoost or a deep ranking model re-ranks the top candidates. TensorFlow Serving or FastAPI hosts the inference endpoint. Redis caches the top recommendations per user, refreshed asynchronously as new events arrive.</p><p><strong>Step 3: Define the Data Flow.</strong> When a user logs in, the system checks Redis for a cached recommendation set. On a cache miss, the retrieval layer uses vector search to identify 1,000 candidate products. The ranking model scores those candidates and returns the top N. As the user browses, behavioral events stream through Kafka and trigger asynchronous feature updates, keeping recommendations fresh throughout the session.</p><h3>AI System Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*5J7V6bIf1S4r_3Kugk2CtA.gif" /></figure><h3>Key Takeaways</h3><p>Hybrid architectures combine classical distributed systems engineering with ML workflows and agentic orchestration patterns. Feature stores are the connective tissue between training and serving and the primary defense against training-serving skew. Offline and online pipelines serve different masters and must be designed independently but kept in sync. Agentic systems require memory, orchestration, and reasoning infrastructure that stateless prediction APIs do not. Observability, fault tolerance, privacy, and security are not optional additions; they are the difference between a prototype and a production system.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>If you enjoy honest, practical breakdowns of AI , ML, and developer stacks, <strong>follow me here on </strong><a href="https://medium.com/@neehanthreddym"><strong>neehanthreddym</strong></a> for more comparisons like this one — no fluff, no sponsored takes.</p><p>I also share extra resources, tool experiments, and short weekly notes over on Substack — <a href="https://aideck.substack.com/?r=6cpu7x&amp;utm_campaign=pub-share-checklist"><strong>subscribe here</strong></a> if you want that in your inbox.</p><p>Linkedin: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=653d11299550" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LightRAG: How Graph-Powered Retrieval Is Fixing What’s Broken in RAG Systems]]></title>
            <link>https://medium.com/@neehanthreddym/lightrag-how-graph-powered-retrieval-is-fixing-whats-broken-in-rag-systems-fbc2a84c2cd5?source=rss-92249a1c94d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbc2a84c2cd5</guid>
            <category><![CDATA[rag-system]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Neehanth Reddy Maramreddy]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 13:46:00 GMT</pubDate>
            <atom:updated>2026-03-07T13:46:00.604Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A deep dive into the architecture, innovations, and real-world implications of LightRAG — the open-source framework redefining how AI systems retrieve and reason over knowledge.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*65Z8DUyQ3sz5JpKRxeAztA.png" /><figcaption>Image Credits: NotebookLLM</figcaption></figure><h3>The Problem With How AI “Looks Things Up”</h3><p>Imagine you ask a colleague, “How is the rise of electric vehicles changing urban air quality and public transit planning?” A knowledgeable human would draw connections across everything they know — weaving climate science, urban policy, infrastructure economics, and technology adoption into a cohesive answer.</p><p>Now ask the same question to most AI systems backed by Retrieval-Augmented Generation (RAG). You’d likely get three separate fragments — one about EVs, one about air quality, one about transit — stitched together into a response that technically answers your question but misses the <em>connective tissue</em> that makes the answer truly useful.</p><p>This is the core failure mode of traditional RAG: <strong>flat retrieval for a world full of interconnected ideas.</strong></p><p>LightRAG, introduced in the paper <em>“LightRAG: Simple and Fast Retrieval-Augmented Generation”</em> (accepted to EMNLP 2025 Findings) and released as an open-source framework by the HKU Data Science Lab, proposes a fundamentally different approach. Instead of searching over disjointed text chunks, it builds a <strong>knowledge graph</strong> — a living map of entities and their relationships and retrieves over <em>that</em>.</p><p>The result? Faster, richer, and dramatically more comprehensive answers, at a fraction of the computational cost of competing graph-based approaches.</p><h3>What Makes Traditional RAG Fall Short</h3><p>Standard RAG systems follow a straightforward pipeline: break a large document corpus into chunks, embed those chunks as vectors, and at query time, find the chunks most similar to the query and feed them to a language model.</p><p>This works well for narrow, factual lookups. But it breaks down quickly when queries require:</p><ul><li><strong>Cross-document synthesis</strong> — connecting ideas that appear in separate texts</li><li><strong>Multi-hop reasoning</strong> — following a chain of relationships (A relates to B, which relates to C)</li><li><strong>Contextual coherence</strong> — understanding how multiple entities interrelate, not just where they individually appear</li></ul><p>More sophisticated approaches like GraphRAG tried to solve this with community detection — clustering entities into topic communities and generating summary reports for each. But this introduced its own bottlenecks: rebuilding communities when new data arrives is expensive, and querying requires traversing hundreds of community reports with hundreds of API calls.</p><p>LightRAG addresses both the expressiveness problem <em>and</em> the cost problem simultaneously.</p><h3>Inside the LightRAG Architecture</h3><h4>1. Graph-Based Text Indexing</h4><p>LightRAG starts by doing what most RAG systems skip: <strong>understanding the structure of the information</strong>, not just its surface content.</p><p><strong>Entity and Relationship Extraction</strong> Documents are segmented into manageable chunks, then passed through a Large Language Model (LLM) with a carefully designed prompt. The LLM identifies entities — people, places, organizations, concepts, events and the relationships between them. For example, from the sentence <em>“Cardiologists assess symptoms to identify potential heart issues,”</em> it might extract:</p><ul><li>Entity: Cardiologists (Type: Person/Role)</li><li>Entity: Heart Disease (Type: Medical Condition)</li><li>Relationship: Cardiologists diagnose Heart Disease (with a description and strength score)</li></ul><p><strong>Key-Value Profiling</strong> Each extracted entity and relationship is profiled into a text key-value pair. The <em>key</em> is a short phrase optimized for retrieval; the <em>value</em> is a rich summary of relevant context. For relationships, the LLM also generates high-level thematic keywords that capture the broader concepts the relationship touches on — enabling both specific and abstract lookup later.</p><p><strong>Deduplication</strong> The same entity might be mentioned in dozens of document chunks. Rather than storing it dozens of times, LightRAG merges duplicate entries, keeping the graph lean and operations efficient.</p><p>The result is a <strong>comprehensive knowledge graph</strong> D̂ = (V̂, Ê) — a network of entities (nodes) and relationships (edges) with rich textual annotations constructed from the entire document corpus.</p><h4>2. The Dual-Level Retrieval Paradigm</h4><p>One of LightRAG’s most elegant design choices is recognizing that not all queries are created equal.</p><p>Some questions are <strong>specific</strong>: <em>“Who wrote Pride and Prejudice?”</em> — they require precise lookup of a particular entity or relationship.</p><p>Others are <strong>abstract</strong>: <em>“How does artificial intelligence influence modern education?”</em> — they require synthesizing patterns across many entities and themes.</p><p>LightRAG handles both with a unified dual-level retrieval system:</p><p><strong>Low-Level Retrieval</strong> Focused on specific entities and their immediate neighborhoods. When you ask a precise question, LightRAG extracts <em>local keywords</em> from your query and matches them against entity nodes in the graph. It then gathers neighboring nodes — the one-hop connections around retrieved entities — to capture immediate relational context.</p><p><strong>High-Level Retrieval</strong> Focused on broader themes and multi-entity aggregations. LightRAG extracts <em>global keywords</em> from the query and matches them against the relationship edges, which carry thematic annotations generated during indexing. This allows the system to surface overarching patterns and synthesize information across clusters of related entities.</p><p><strong>The Hybrid Mode</strong> In practice, LightRAG runs both levels simultaneously. A single query retrieves specific entities <em>and</em> thematic relationships, combines them with their surrounding graph neighborhoods, and delivers a retrieval context that is both <em>deep</em> (precise entity details) and <em>broad</em> (thematic understanding).</p><p>The querying interface exposes several modes: local, global, hybrid, naive, mix, and bypass — giving developers fine-grained control over the retrieval strategy for different use cases.</p><h4>3. Answer Generation</h4><p>The retrieved content — entity descriptions, relationship summaries, and relevant text excerpts — is concatenated and passed alongside the original query to a general-purpose LLM.</p><p>This multi-source context gives the language model everything it needs to generate answers that are not just accurate, but <strong>comprehensively grounded</strong> in the structure of the knowledge base. The LLM isn’t guessing at connections; those connections have already been surfaced by the graph.</p><h4>4. Incremental Updates: The Underrated Feature</h4><p>In real-world deployments, data doesn’t stand still. New documents arrive constantly — updated regulations, new research papers, recent news. Traditional RAG systems handle this reasonably well (just add new chunks to the vector store). But GraphRAG-style systems hit a wall: adding new data means rebuilding community clusters, regenerating community reports, and incurring massive token costs.</p><p>LightRAG’s approach is elegantly simple: when a new document D&#39; arrives, extract its entities and relationships the same way as before, producing a new subgraph D̂&#39;. Then <strong>merge</strong> the new nodes and edges into the existing graph — a union operation that requires no reconstruction of existing structure.</p><p>New entities appear where they belong. New relationships connect to existing entities. The graph grows organically, and the system stays current without expensive rebuilds.</p><h3>What Drives the Performance</h3><p>The research team ran careful ablations to understand what each component contributes:</p><p><strong>Remove high-level retrieval (low-level only):</strong> Performance degrades on complex queries requiring broad synthesis. The system becomes too focused on individual entities to see the bigger picture.</p><p><strong>Remove low-level retrieval (high-level only):</strong> Comprehensiveness increases, but precise entity-specific answers suffer. The system sees the forest but misses the trees.</p><p><strong>Remove original text, keep graph only:</strong> Surprisingly, performance doesn’t drop significantly — and sometimes <em>improves</em>. The graph-based indexing captures key information so effectively that raw text chunks can introduce noise rather than signal.</p><p>This last finding is particularly notable: it suggests that the knowledge graph isn’t just a lookup index, it’s itself a <strong>compressed, structured representation of knowledge</strong> that can substitute for raw text in many retrieval scenarios.</p><h3>Building With LightRAG</h3><p>LightRAG is available as an open-source Python framework at <a href="https://github.com/HKUDS/LightRAG">github.com/HKUDS/LightRAG</a>. The setup follows a straightforward pattern:</p><pre>from lightrag import LightRAG, QueryParam<br>from lightrag.llm.openai import gpt_4o_mini_complete, openai_embed<br><br>rag = LightRAG(<br>    working_dir=&quot;./my_knowledge_base&quot;,<br>    llm_model_func=gpt_4o_mini_complete,<br>    embedding_func=openai_embed,<br>)<br><br># Index documents<br>await rag.ainsert(&quot;Your document text here...&quot;)<br><br># Query with hybrid mode<br>result = await rag.aquery(<br>    &quot;How does renewable energy policy affect urban planning?&quot;,<br>    param=QueryParam(mode=&quot;hybrid&quot;)<br>)</pre><p>The framework supports a wide range of LLM and embedding backends: OpenAI (GPT-4o, GPT-4o-mini), Azure OpenAI, AWS Bedrock, Google Gemini, Ollama, local Hugging Face models, and SentenceTransformers. An Ollama-compatible API layer means you can point existing chat UIs directly at LightRAG as if it were a standard local model.</p><p>The official repository also ships with a <strong>Web UI</strong> for document indexing and querying, a <strong>3D graph visualizer</strong> for exploring the knowledge graph interactively, and workspace isolation for running multiple independent RAG instances.</p><h3>The Bigger Picture</h3><p>LightRAG represents a meaningful step in a larger trend: moving AI retrieval systems from <em>document retrieval</em> toward <em>knowledge retrieval</em>. The shift matters because real knowledge isn’t stored in documents — it lives in the relationships <em>between</em> the facts those documents contain.</p><p>By making the knowledge graph a first-class citizen of the retrieval pipeline and doing so efficiently enough to be practical: LightRAG opens a path toward AI systems that don’t just find information, but genuinely <em>understand</em> the knowledge domain they’re reasoning over.</p><p>As a practical, open-source tool that outperforms its predecessors while cutting costs by orders of magnitude, LightRAG is worth taking seriously.</p><blockquote>LightRAG is open-source and available at <a href="https://github.com/HKUDS/LightRAG">github.com/HKUDS/LightRAG</a>. The research paper “LightRAG: Simple and Fast Retrieval-Augmented Generation” was accepted to EMNLP 2025 Findings.</blockquote><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>If you enjoy honest, practical breakdowns of AI , ML, and developer stacks, <strong>follow me here on </strong><a href="https://medium.com/@neehanthreddym"><strong>neehanthreddym</strong></a> for more comparisons like this one — no fluff, no sponsored takes.</p><p>I also share extra resources, tool experiments, and short weekly notes over on Substack — <a href="https://aideck.substack.com/?r=6cpu7x&amp;utm_campaign=pub-share-checklist"><strong>subscribe here</strong></a> if you want that in your inbox.</p><p>Linkedin: <a href="https://linkedin.com/in/neehanthreddy">@neehanthreddy</a> | Data, AI, ML in plain terms</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbc2a84c2cd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>