<?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: Aashir As</title>
    <description>The latest articles on DEV Community by Aashir As (@aashir04m).</description>
    <link>https://dev.to/aashir04m</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3888391%2F138ed087-f64d-4cea-a969-a425825e5fa8.jpg</url>
      <title>DEV Community: Aashir As</title>
      <link>https://dev.to/aashir04m</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aashir04m"/>
    <language>en</language>
    <item>
      <title>5 Architecture Decisions That Kill AI Projects Before They Launch</title>
      <dc:creator>Aashir As</dc:creator>
      <pubDate>Mon, 20 Apr 2026 07:13:19 +0000</pubDate>
      <link>https://dev.to/aashir04m/5-architecture-decisions-that-kill-ai-projects-before-they-launch-4db8</link>
      <guid>https://dev.to/aashir04m/5-architecture-decisions-that-kill-ai-projects-before-they-launch-4db8</guid>
      <description>&lt;p&gt;$684 billion was invested in AI initiatives in 2025. More than $547 billion of that failed to deliver value (RAND Corporation). That's not a model problem. That's mostly an architecture problem.&lt;/p&gt;

&lt;p&gt;I've been on the failing side of this. Here are the five architectural decisions that caused the most damage, across 50+ AI projects we've built at Afnexis.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Building the Model Before Validating the Data
&lt;/h2&gt;

&lt;p&gt;I learned this the hard way on a fraud detection project. The client had 18 months of transaction data. We built a beautiful gradient boosting classifier. Precision: 91%. We were proud of it.&lt;/p&gt;

&lt;p&gt;Then we discovered their fraud labels were generated by their old rules engine, not by human review. The rules engine had a known flaw that mislabeled certain transaction types. We'd trained a model to replicate a broken system at 91% accuracy.&lt;/p&gt;

&lt;p&gt;The fix cost four weeks. The root cause took four minutes to identify.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The decision that killed it:&lt;/strong&gt; Starting model development before auditing label quality. We now treat data auditing as a non-negotiable gate before writing model code. Every project. No exceptions.&lt;/p&gt;

&lt;p&gt;What to check before you write a line of code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are labels generated by humans, rules, or another model?&lt;/li&gt;
&lt;li&gt;What's the label error rate? (Use Cleanlab or manual spot-checking)&lt;/li&gt;
&lt;li&gt;What's the class balance? How were rare events captured?&lt;/li&gt;
&lt;li&gt;Is there data leakage between train and test splits?&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Treating Inference as an Afterthought
&lt;/h2&gt;

&lt;p&gt;Most ML tutorials end at model accuracy. Production starts at inference.&lt;/p&gt;

&lt;p&gt;A client needed real-time credit decisions. We trained a beautiful model with strong AUC scores. Then we tested serving latency. P95 response time: 2.3 seconds. Their requirement: under 200ms.&lt;/p&gt;

&lt;p&gt;The model used 340 features, 20 of which required live API calls at inference time. We'd designed for accuracy, not for serving. Rebuilding the inference architecture added five weeks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Define the serving constraints before training. Before a single model runs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What's the maximum acceptable latency? (P95, not average)&lt;/li&gt;
&lt;li&gt;What features are available at inference time, with no latency penalty?&lt;/li&gt;
&lt;li&gt;Is the serving environment CPU, GPU, or edge?&lt;/li&gt;
&lt;li&gt;What's the expected RPS (requests per second)?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These constraints shape model architecture, feature selection, and serving infrastructure. Define them first.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. One Monolithic Model for Everything
&lt;/h2&gt;

&lt;p&gt;I once built a single model for a healthcare client that was supposed to classify 14 different document types. It worked okay on 9 of them and poorly on 5. When we pushed updates to improve the poor performers, we sometimes degraded the good ones.&lt;/p&gt;

&lt;p&gt;The model was trying to do too much. Different document types have different data distributions, different error costs, and different update frequencies. Treating them as one problem made the engineering worse, not simpler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Ensemble-first architecture. Start by asking: can this problem be decomposed into smaller problems with clearer boundaries? For My Medical Records AI, we ended up with separate specialist models for lab reports, discharge summaries, prescriptions, and referral letters. Each could be updated independently. Each had its own monitoring. Accuracy improved on every category.&lt;/p&gt;

&lt;p&gt;Monolithic models feel simpler at first. They're not.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. No Feedback Loop from Production
&lt;/h2&gt;

&lt;p&gt;Models degrade. That's not a hypothesis. MIT research found 91% of ML models see accuracy decline over time without active monitoring. The question isn't whether your model will drift. It's whether you'll know before your users do.&lt;/p&gt;

&lt;p&gt;We shipped a churn prediction model for a SaaS client. Six months later, the business had launched two new product lines. User behavior patterns had shifted significantly. The model's precision dropped from 78% to 61%. Nobody noticed for eight weeks. The sales team was acting on stale predictions the whole time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Every model ships with a feedback loop. Specifically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Outcome tracking:&lt;/strong&gt; Did the predicted thing actually happen? Link predictions to outcomes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distribution monitoring:&lt;/strong&gt; Are the features at inference time still distributed like the training data?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confidence tracking:&lt;/strong&gt; Is average confidence dropping? That's usually the first signal of drift.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ground truth sampling:&lt;/strong&gt; Regularly label a random sample of recent predictions. Compare to model output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can't close the loop between model output and real-world outcomes, you're flying blind.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Hard-Coding the LLM Provider
&lt;/h2&gt;

&lt;p&gt;This feels like a minor architectural decision until you get a surprise pricing change or a model deprecation notice.&lt;/p&gt;

&lt;p&gt;We built a document analysis system for a fintech client using GPT-4 directly. Six months later, GPT-4 was deprecated in favor of GPT-4o with a different API signature. Migration cost: two weeks and a small bug in production that nobody caught immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Abstract the LLM provider behind an interface from day one. The calling code doesn't know if it's talking to OpenAI, Anthropic, or a self-hosted Llama model. Provider configuration lives in environment variables, not in code. Switching providers is a config change, not a refactor.&lt;/p&gt;

&lt;p&gt;This also lets you run cost experiments: route 10% of traffic to a cheaper model and measure if quality degrades. You can't do that if your provider is hard-coded.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Pattern
&lt;/h2&gt;

&lt;p&gt;Every one of these failures came from building for the demo, not for production. Models are trained on clean test data. Production has messy data, time pressure, and users who break assumptions.&lt;/p&gt;

&lt;p&gt;The best architectural advice I have: write down your production constraints before your first model run. Latency, labels, feedback loops, serving environment, provider flexibility. One page. It'll save you weeks.&lt;/p&gt;

&lt;p&gt;More on what kills AI projects in production: &lt;a href="https://afnexis.com/articles/why-ai-projects-fail" rel="noopener noreferrer"&gt;Why AI Projects Fail — and What To Do Instead&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Aashir Tariq is the CEO of &lt;a href="https://afnexis.com" rel="noopener noreferrer"&gt;Afnexis&lt;/a&gt;. We've shipped 50+ production AI systems across healthcare, fintech, and real estate. If your AI project is stuck between POC and production, that's what we fix.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>7 Production RAG Mistakes I Made (And How to Fix Them)</title>
      <dc:creator>Aashir As</dc:creator>
      <pubDate>Mon, 20 Apr 2026 07:12:10 +0000</pubDate>
      <link>https://dev.to/aashir04m/7-production-rag-mistakes-i-made-and-how-to-fix-them-26jl</link>
      <guid>https://dev.to/aashir04m/7-production-rag-mistakes-i-made-and-how-to-fix-them-26jl</guid>
      <description>&lt;p&gt;I've shipped RAG systems for healthcare records, financial document search, and real estate databases. The early ones had problems that cost us weeks of debugging in production. Here are the seven mistakes I made most often and what we do now instead.&lt;/p&gt;

&lt;p&gt;Want the full production architecture before reading this? Start here: &lt;a href="https://afnexis.com/articles/build-rag-system" rel="noopener noreferrer"&gt;How to Build a Production RAG System&lt;/a&gt;. This post is about the failure modes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 1: Fixed-Size Chunking
&lt;/h2&gt;

&lt;p&gt;I split every document into 512-token chunks with 50-token overlap. It felt clean and predictable. It broke almost immediately on real documents.&lt;/p&gt;

&lt;p&gt;A medical discharge summary doesn't divide neatly at 512 tokens. A section heading on token 511 would be split from its content on token 513. The retriever would pull the heading without the details, or the details without the heading. The LLM got fragments and hallucinated to fill the gaps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Semantic chunking based on document structure. For medical documents, we split at section boundaries (Chief Complaint, History, Medications, etc.) using regex + NLP, not fixed token counts. For PDFs without clear structure, we use recursive character text splitting with overlap tuned per document type, not a global default.&lt;/p&gt;

&lt;p&gt;If your chunks have orphaned headings or context-free numbers, your chunking strategy is wrong. Audit 20 random chunks before moving on.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 2: Vector Search Only
&lt;/h2&gt;

&lt;p&gt;My first instinct was: embed everything, use cosine similarity, done. It worked on my test set. It failed on production queries.&lt;/p&gt;

&lt;p&gt;A radiologist asked: "Show me all reports mentioning 'ground glass opacity' from Q3." Semantic search retrieved reports about lung pathology in general. The specific phrase wasn't matched because its vector representation was similar to dozens of other lung terms. Keyword search would've nailed it instantly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Hybrid retrieval. BM25 for exact term matching, vector search for semantic similarity, then Reciprocal Rank Fusion to merge the results. For our RadShifts deployment, hybrid retrieval cut false negative rate by 34% compared to vector-only. That's not a small number when the output is a clinical document.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 3: No Retrieval Validation Before Generation
&lt;/h2&gt;

&lt;p&gt;Here's a failure mode I didn't anticipate: the retriever returns results, but they're all irrelevant. The LLM doesn't know that. It generates a confident, detailed, completely wrong answer from the retrieved garbage.&lt;/p&gt;

&lt;p&gt;On one healthcare client, a query about "aspirin contraindications" was returning cardiology records about aspirin therapy. Technically related. Completely wrong context. The LLM synthesized a response that mixed treatment instructions with contraindications. Nobody caught it for two weeks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; A retrieval validation layer between the retriever and the generator. We score each retrieved chunk against the query (cross-encoder reranking), set a minimum relevance threshold, and route low-confidence retrievals to a fallback. The fallback either returns a "not found" response or escalates to a human reviewer. The LLM never sees irrelevant context.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 4: Embedding Drift
&lt;/h2&gt;

&lt;p&gt;Six months after launch, our semantic search accuracy dropped noticeably. The documents hadn't changed. The queries hadn't changed. What changed: the embedding model provider had pushed an update.&lt;/p&gt;

&lt;p&gt;The new model produced slightly different vector representations for the same text. Our indexed embeddings from six months ago were now in a different vector space than fresh query embeddings. Retrieval quality degraded because we were comparing apples to oranges at the vector level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; We pin embedding model versions by name and hash. When a new model version is available, we re-embed the entire corpus before switching. We also track embedding drift as a metric in production: periodically re-embed a sample of documents and compare cosine similarity against the original embeddings. If drift exceeds a threshold, we trigger a full re-index.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 5: No Document Versioning
&lt;/h2&gt;

&lt;p&gt;Legal documents change. Medical protocols get updated. Product specifications get revised. Our RAG systems didn't know that.&lt;/p&gt;

&lt;p&gt;We'd index version 1 of a contract. The client would update the contract. We'd index version 2. Now the corpus contained contradictory information from the same document. The LLM would retrieve both versions and synthesize an answer that was partly right and partly wrong, with no way for the user to know which version was used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Document versioning as a first-class citizen. Every document gets a version field and a validity period. When a new version is ingested, the old version is either archived (removed from active retrieval) or marked as superseded. Queries against an archived document return the new version with a note that the source was updated.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 6: Treating Permissions As an Afterthought
&lt;/h2&gt;

&lt;p&gt;This one almost cost us a client relationship. I won't name them, but the domain was financial services.&lt;/p&gt;

&lt;p&gt;Our RAG system was deployed across multiple user roles. A junior analyst ran a query. The retriever pulled a highly relevant document. The document was a board-level financial projection not cleared for analyst access. We'd implemented permissions at the UI layer. The retrieval layer didn't know about permissions at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Permissions applied at query time, at the retrieval layer, not at display time. Every document in the index carries metadata about who can access it. Every query is tagged with the requesting user's role and permissions. The retriever filters candidates by permission before ranking. The LLM never sees a document the user isn't authorized to read.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mistake 7: Flying Blind in Production
&lt;/h2&gt;

&lt;p&gt;We shipped. We got positive feedback. We assumed the system was working.&lt;/p&gt;

&lt;p&gt;Three months in, a client mentioned that questions about a specific topic were getting vague answers. We looked at the logs. Query-to-retrieval latency had doubled. Retrieval quality had degraded across a whole document category. Neither of us had noticed because we weren't tracking it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do now:&lt;/strong&gt; Four metrics in production for every RAG system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval precision:&lt;/strong&gt; Are the top-k results actually relevant to the query?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answer groundedness:&lt;/strong&gt; Is the generated answer supported by the retrieved context? (Use an LLM-as-judge to score this)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Query latency (p95):&lt;/strong&gt; Not average. p95. Averages hide the tail.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval gap rate:&lt;/strong&gt; What percentage of queries return no results or low-confidence results?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Set up alerts on all four before launch. Not after.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mistake&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fixed-size chunking&lt;/td&gt;
&lt;td&gt;Fragmented, context-free retrievals&lt;/td&gt;
&lt;td&gt;Semantic chunking by document structure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vector search only&lt;/td&gt;
&lt;td&gt;Exact terms missed&lt;/td&gt;
&lt;td&gt;Hybrid BM25 + vector + RRF&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No retrieval validation&lt;/td&gt;
&lt;td&gt;Confident wrong answers&lt;/td&gt;
&lt;td&gt;Cross-encoder reranking + minimum relevance threshold&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Embedding drift&lt;/td&gt;
&lt;td&gt;Silent accuracy degradation&lt;/td&gt;
&lt;td&gt;Pin model versions, monitor vector drift&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No document versioning&lt;/td&gt;
&lt;td&gt;Contradictory answers&lt;/td&gt;
&lt;td&gt;Version field + validity period + archive on update&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Permissions afterthought&lt;/td&gt;
&lt;td&gt;Unauthorized content retrieved&lt;/td&gt;
&lt;td&gt;Filter by permissions at retrieval layer, not display layer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No production monitoring&lt;/td&gt;
&lt;td&gt;Problems found by users, not by you&lt;/td&gt;
&lt;td&gt;4 core metrics: precision, groundedness, latency, gap rate&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  One More Thing
&lt;/h2&gt;

&lt;p&gt;These are mistakes I made on real systems. Most RAG tutorials show you a working demo. They don't show you what breaks at 3am six months after launch.&lt;/p&gt;

&lt;p&gt;If you're building a RAG system for production, the architecture decisions that matter most aren't which vector database to use. They're the ones above.&lt;/p&gt;

&lt;p&gt;Full production RAG architecture guide, including chunking strategy, index design, and the seven failure points in order of impact: &lt;a href="https://afnexis.com/articles/build-rag-system" rel="noopener noreferrer"&gt;Building a Production RAG System&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Aashir Tariq is the CEO of &lt;a href="https://afnexis.com" rel="noopener noreferrer"&gt;Afnexis&lt;/a&gt;, an AI development company that's shipped 50+ production AI systems for healthcare, fintech, and real estate clients.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>llm</category>
      <category>mcp</category>
    </item>
  </channel>
</rss>
