<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mridul Nagpal</title>
    <description>The latest articles on DEV Community by Mridul Nagpal (@mridul_nagpal_e33b6be1260).</description>
    <link>https://dev.to/mridul_nagpal_e33b6be1260</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1822908%2F3dc84b52-9ae5-44ca-9a2a-4c5c875233dc.jpeg</url>
      <title>DEV Community: Mridul Nagpal</title>
      <link>https://dev.to/mridul_nagpal_e33b6be1260</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mridul_nagpal_e33b6be1260"/>
    <language>en</language>
    <item>
      <title>Machine learning in production: the model is the easy part</title>
      <dc:creator>Mridul Nagpal</dc:creator>
      <pubDate>Wed, 24 Jun 2026 04:09:32 +0000</pubDate>
      <link>https://dev.to/mridul_nagpal_e33b6be1260/machine-learning-in-production-the-model-is-the-easy-part-3l5l</link>
      <guid>https://dev.to/mridul_nagpal_e33b6be1260/machine-learning-in-production-the-model-is-the-easy-part-3l5l</guid>
      <description>&lt;p&gt;A model that scores 95% on your test set feels like the finish line. Then you ship it, and you find out it was the starting line. The model was maybe 10% of the work; everything that makes it survive production is the other 90%.&lt;/p&gt;

&lt;p&gt;We deploy machine-learning systems for companies, and the projects that stall almost never stall on model accuracy. They stall on the engineering around the model. Here's what actually breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Training-serving skew
&lt;/h2&gt;

&lt;p&gt;Your model was trained on clean, batch-computed features. In production it gets features computed by different code, at request time, sometimes from a slightly different source. The distributions drift apart and accuracy quietly craters — with no error, no crash, just worse predictions.&lt;/p&gt;

&lt;p&gt;The fix is sharing one feature-computation path between training and serving (a feature store or shared library), and logging production features so you can compare them against training. If training and serving don't compute features the same way, nothing else matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The model rots and nobody notices
&lt;/h2&gt;

&lt;p&gt;The world changes — user behaviour, pricing, seasonality, an upstream schema. A model frozen at launch slowly decays against a moving target. Without monitoring, the first signal you get is a business metric dropping months later.&lt;/p&gt;

&lt;p&gt;Monitor input drift and prediction distributions, not just uptime. Alert when the live data stops looking like the training data. Treat "the model still works" as a claim that needs evidence, not an assumption.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. There's no retraining pipeline
&lt;/h2&gt;

&lt;p&gt;"We'll retrain when it degrades" usually means a person manually re-running a notebook they half-remember. Build the retraining path early: reproducible data snapshots, an automated training run, evaluation against a held-out set, and a gate that blocks a worse model from shipping. Retraining should be a button, not an archaeology project.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The offline winner loses online
&lt;/h2&gt;

&lt;p&gt;The model with the best test-set score is often too slow or too expensive to serve at real traffic. Latency and cost are product features. Sometimes a smaller, simpler model that answers in 50ms beats a heavyweight that needs 2 seconds — because users feel the 2 seconds and the heavyweight quietly blows the budget.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Accuracy is not the business metric
&lt;/h2&gt;

&lt;p&gt;A fraud model at 99% accuracy is worthless if it flags so many false positives that support drowns. Define the metric that maps to the actual outcome — caught fraud net of review cost, handle-time saved, conversion lifted — and optimise that. Accuracy is a proxy, and proxies get gamed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern underneath all of these
&lt;/h2&gt;

&lt;p&gt;None of this is exotic ML. It's data engineering, monitoring, CI/CD, and clear success metrics — applied to a component that happens to be statistical and non-deterministic. The teams whose models create value aren't the ones with the fanciest architecture; they're the ones who treat the model as one part of a production system that has to be observed, retrained, and held to a real metric.&lt;/p&gt;

&lt;p&gt;That's the lens we bring from running production systems at scale before this wave. If you have models that work in a notebook but stall on the way to production, that's the kind of &lt;a href="https://krazimo.com/services/machine-learning-deployment/" rel="noopener noreferrer"&gt;machine-learning deployment and consulting work we do at Krazimo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What's killed an ML project for you on the way to production? I'll get into specifics in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>mlops</category>
    </item>
    <item>
      <title>RAG in production: the failure modes nobody warns you about</title>
      <dc:creator>Mridul Nagpal</dc:creator>
      <pubDate>Wed, 24 Jun 2026 03:55:15 +0000</pubDate>
      <link>https://dev.to/mridul_nagpal_e33b6be1260/rag-in-production-the-failure-modes-nobody-warns-you-about-62i</link>
      <guid>https://dev.to/mridul_nagpal_e33b6be1260/rag-in-production-the-failure-modes-nobody-warns-you-about-62i</guid>
      <description>&lt;p&gt;Retrieval-augmented generation looks trivial in a tutorial: embed some documents, drop them in a vector database, stuff the top matches into a prompt, done. Then you point it at real company data and real users, and you discover that the demo was the easy 10%.&lt;/p&gt;

&lt;p&gt;We build RAG systems over private knowledge for companies, and almost every painful bug traces back to the same handful of failure modes. Here they are, and what actually fixes them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Retrieval returns the wrong chunks — and the model uses them anyway
&lt;/h2&gt;

&lt;p&gt;The single biggest source of "wrong" RAG answers isn't the LLM. It's retrieval handing it irrelevant or partial context, which the model then summarizes with total confidence. Naive fixed-size chunking splits a table from its header, or a clause from the sentence that negates it.&lt;/p&gt;

&lt;p&gt;The fix is unglamorous data engineering: chunk on semantic boundaries, not character counts; add a &lt;strong&gt;reranking&lt;/strong&gt; step so the top-k you actually pass is the top-k by relevance, not by raw vector distance; and store enough metadata to filter before you search. Retrieval quality sets the ceiling on everything downstream.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The model answers beyond its context
&lt;/h2&gt;

&lt;p&gt;Even with perfect retrieval, an LLM will happily fill gaps with plausible invention. In a RAG system that's worse than no answer, because it looks sourced.&lt;/p&gt;

&lt;p&gt;Force grounding: instruct the model to answer &lt;em&gt;only&lt;/em&gt; from the retrieved context and to say "I don't know" when the context doesn't cover it — then verify that with citations that point back to specific chunks. If you can't trace a sentence to a source, treat it as a hallucination, not an answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The knowledge goes stale, and nobody notices
&lt;/h2&gt;

&lt;p&gt;RAG is only as good as the index behind it. Documents change, get duplicated, get deleted — and a pipeline that ingested once at launch quietly serves last quarter's truth. The unsexy work is the ingestion pipeline: incremental re-indexing, de-duplication, and a freshness signal so old content can be down-weighted or expired.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. You have no evals, so you're guessing
&lt;/h2&gt;

&lt;p&gt;"The new embedding model feels better" is not an engineering statement. Without a held-out set of real questions with known-good answers, every change is a coin flip — you fix one query and silently break five. Build an eval set early, measure retrieval hit-rate and answer faithfulness on every change, and treat a regression like a failing test.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Latency and cost sneak up on you
&lt;/h2&gt;

&lt;p&gt;Embedding the query, searching, reranking, and stuffing a large context into a big model adds up — in both seconds and dollars. Cache embeddings and frequent queries, retrieve fewer-but-better chunks rather than dumping everything, and reserve the largest model for the steps that genuinely need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern underneath all of these
&lt;/h2&gt;

&lt;p&gt;Notice what's missing from that list: clever prompting. Production RAG is a &lt;strong&gt;data and retrieval engineering&lt;/strong&gt; problem wearing an AI costume. The teams whose RAG holds up aren't the ones with the fanciest prompt — they're the ones who treat ingestion, chunking, retrieval, and evaluation as real systems with real tests.&lt;/p&gt;

&lt;p&gt;That's the lens we bring from years of building data systems at scale before this wave. If you're moving a RAG prototype toward something users can actually trust in production, that's the kind of &lt;a href="https://krazimo.com/products/rag/" rel="noopener noreferrer"&gt;RAG and knowledge-AI work we do at Krazimo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What's bitten you hardest in a production RAG system? I'll dig into specifics in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
      <category>rag</category>
    </item>
    <item>
      <title>What actually breaks when you put AI agents in production</title>
      <dc:creator>Mridul Nagpal</dc:creator>
      <pubDate>Tue, 23 Jun 2026 08:18:04 +0000</pubDate>
      <link>https://dev.to/mridul_nagpal_e33b6be1260/what-actually-breaks-when-you-put-ai-agents-in-production-b7n</link>
      <guid>https://dev.to/mridul_nagpal_e33b6be1260/what-actually-breaks-when-you-put-ai-agents-in-production-b7n</guid>
      <description>&lt;p&gt;Demos lie. An AI agent that books a meeting, queries an API, and summarizes the result in a slick demo is maybe 20% of the work. The other 80% is everything that happens when the same agent meets a real user, real data, and a Tuesday afternoon when an upstream API is having a bad day.&lt;/p&gt;

&lt;p&gt;We build multi-agent systems for companies for a living, and the gap between "works in the notebook" and "works in production" is where most AI projects quietly die. Here are the failure modes we see most often — and what we actually do about them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The agent is confidently wrong, and nothing catches it
&lt;/h2&gt;

&lt;p&gt;A single LLM call has no idea when it's hallucinating. Chain three of them together and the errors compound: agent A invents a customer ID, agent B dutifully looks it up, agent C writes a confident summary about a customer who doesn't exist.&lt;/p&gt;

&lt;p&gt;The fix isn't a better prompt. It's &lt;strong&gt;treating every agent output as untrusted input&lt;/strong&gt; — the same discipline you'd apply to a form field from the public internet. Validate structured outputs against a schema. Make tools return typed results, not prose. And put a deterministic check between "the model decided X" and "X happened in your database."&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[REAL EXAMPLE → a time a validation layer caught a bad agent action before it hit prod, and what the check was]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. There's no boundary between "thinking" and "doing"
&lt;/h2&gt;

&lt;p&gt;The scariest agent bugs aren't wrong answers — they're wrong &lt;em&gt;actions&lt;/em&gt;. An agent with write access to your systems and a fuzzy objective will eventually do something irreversible.&lt;/p&gt;

&lt;p&gt;We draw a hard line between read and write. Agents can plan, retrieve, and propose freely. Anything that mutates state — sends an email, charges a card, updates a record — goes through a narrow, audited gate with explicit guardrails, and often a human approval step for the high-stakes ones. It's the difference between an assistant and a loose cannon.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. You can't see what the agent did
&lt;/h2&gt;

&lt;p&gt;When a multi-agent run fails, "the AI messed up" is not a debuggable statement. If you can't replay exactly which agent called which tool with which arguments and got which result, you're flying blind — and you will be flying blind at 2am when a customer complains.&lt;/p&gt;

&lt;p&gt;Tracing is not optional. Every agent step, every tool call, every input and output gets logged and is replayable. This one decision — building observability &lt;em&gt;before&lt;/em&gt; you scale the agents — saves more production incidents than any model upgrade.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Cost and latency are a feature, not an afterthought
&lt;/h2&gt;

&lt;p&gt;A multi-agent system that calls the biggest model for every step is both slow and expensive, and users feel both. The engineering work is matching the model to the job: a small fast model for routing and classification, the big one only where reasoning genuinely pays for itself. Cache aggressively. Set hard timeouts. Budget tokens like you'd budget any other resource.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[REAL EXAMPLE → a before/after on latency or cost when you right-sized models for a real client]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  5. "Done" is undefined, so it's never done
&lt;/h2&gt;

&lt;p&gt;The most common reason an AI project stalls isn't technical — it's that nobody agreed what success looks like before building. "Add AI agents" is not a spec. "Cut average handle time on tier-1 tickets by 30% without raising escalations" is.&lt;/p&gt;

&lt;p&gt;We define the success metric before writing a line of code. It tells you which failures matter, when to ship, and whether the thing is actually working — instead of shipping an impressive demo that moves no real number.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pattern underneath all of these
&lt;/h2&gt;

&lt;p&gt;None of this is exotic AI knowledge. It's ordinary production engineering — input validation, least-privilege access, observability, resource budgets, clear requirements — applied to a new and unusually unpredictable component. The teams that ship reliable agents aren't the ones with the cleverest prompts. They're the ones who treat the LLM as one more untrusted, expensive, non-deterministic dependency and engineer around it accordingly.&lt;/p&gt;

&lt;p&gt;That's the lens we bring from years of building systems at scale before this wave: the AI is new, but the discipline that makes it production-grade is not. If you're moving an agent system from demo to production and want a second set of eyes from a team that does this daily, that's the kind of &lt;a href="https://krazimo.com/services/multi-agent-ai-systems/" rel="noopener noreferrer"&gt;multi-agent AI work we do at Krazimo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What failure modes have bitten you in production? I'll answer questions in the comments.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>llm</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
