惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
博客园_首页
P
Privacy International News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tenable Blog
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
爱范儿
爱范儿
Cyberwarzone
Cyberwarzone
P
Palo Alto Networks Blog
月光博客
月光博客
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security
A
About on SuperTechFans
F
Full Disclosure
The Cloudflare Blog
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Webroot Blog
Webroot Blog
量子位
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
博客园 - 司徒正美
N
Netflix TechBlog - Medium
S
Security @ Cisco Blogs
B
Blog
P
Privacy & Cybersecurity Law Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News - Newest:
Hacker News - Newest: "LLM"
V
Visual Studio Blog
NISL@THU
NISL@THU

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
5 Reasons Your RAG System Will Fail in Production (And the Patterns I Use to Fix Each One)
Muaz · 2026-05-18 · via DEV Community

The 80% Problem

Most RAG demos look magical. You drop in 10 PDFs, ask 3 questions, get clean answers. Ship it.

Then production hits. The document corpus grows from 10 to 10,000. Users ask questions the demo never anticipated. Edge cases stack up. Accuracy drops from 95% to 60% in two weeks. The team starts apologising to the client.

I've built 20+ production RAG systems for clients across the USA, UK, UAE, Canada, Australia, Switzerland, and Pakistan. About 80% of the RAG projects I audit before clients hire me are in this exact failure mode — they passed the demo, then collapsed under real data.

The fixes aren't more complex models. They're architectural patterns designed for failure modes from day one. Here are the five that matter most.

Failure 1: Hallucinations on edge cases

A vanilla RAG pipeline does this: embed the user query, retrieve top-k documents, stuff them into a prompt, ask the LLM to answer. When retrieval finds something, the LLM dutifully constructs an answer — even when the retrieved context is unrelated to the question.

In production, you get confident-sounding nonsense on the long tail of queries.

The fix: a self-correction loop. Before the LLM answers, force it to grade the retrieved context against the question. If the grade is poor, rewrite the query or fall back to a "I don't have enough information" response.

from langgraph.graph import StateGraph, END

def grade_relevance(state):
    docs = state["documents"]
    question = state["question"]
    prompt = f"""Given the question and retrieved documents, score 0-10 how
    relevant the documents are to answering the question. Be strict.
    Question: {question}
    Documents: {docs[:3000]}
    Respond with just a number."""
    score = int(llm.invoke(prompt).content.strip())
    return {"relevance_score": score}

def route_after_grading(state):
    if state["relevance_score"] < 6:
        return "rewrite_query"
    return "generate_answer"

graph = StateGraph(RAGState)
graph.add_node("retrieve", retrieve)
graph.add_node("grade", grade_relevance)
graph.add_node("rewrite_query", rewrite_query)
graph.add_node("generate_answer", generate_answer)
graph.add_conditional_edges("grade", route_after_grading)

Enter fullscreen mode Exit fullscreen mode

I built exactly this pattern for an enterprise client — full breakdown in my Agentic RAG case study. It moved accuracy from ~70% to 90%+ on real questions, and dropped hallucinations to single digits.

Failure 2: Stale retrieval as your data changes

You ship a RAG system on Monday with 500 documents. By Friday, 50 of those documents have been edited. Your vector store still has the old embeddings.

Users ask questions about the new content. The system retrieves the old version. They lose trust.

The fix: incremental re-indexing with content hashing, not full re-builds. Hash each source document. On a schedule (or webhook), only re-embed documents whose hash changed.

import hashlib

def document_hash(text, metadata):
    payload = text + str(sorted(metadata.items()))
    return hashlib.sha256(payload.encode()).hexdigest()

def upsert_if_changed(doc_id, text, metadata, pinecone_index):
    new_hash = document_hash(text, metadata)
    existing = pinecone_index.fetch([doc_id]).vectors.get(doc_id)
    if existing and existing.metadata.get("hash") == new_hash:
        return False  # unchanged, skip
    embedding = embed(text)
    pinecone_index.upsert([{
        "id": doc_id,
        "values": embedding,
        "metadata": {**metadata, "hash": new_hash, "indexed_at": now()}
    }])
    return True

Enter fullscreen mode Exit fullscreen mode

This single pattern saved a client 70% on embedding API costs and kept their knowledge base accurate without manual intervention.

Failure 3: Bad retrieval ranking

Top-k retrieval over pure semantic similarity has a known weakness: it rewards documents that sound similar to the question, not documents that answer the question. Worse, exact keyword matches (product codes, names, error codes) often get ranked below conceptually-similar-but-wrong chunks.

The fix: hybrid search + a reranker. Combine dense vector search with sparse keyword search (BM25), then run the merged candidates through a cross-encoder reranker.

from rank_bm25 import BM25Okapi
from sentence_transformers import CrossEncoder

bm25 = BM25Okapi([doc.text.split() for doc in corpus])
reranker = CrossEncoder("cross-encoder/ms-marco-MiniLM-L-6-v2")

def hybrid_retrieve(query, k=20):
    dense_hits = vector_store.similarity_search(query, k=k)
    sparse_hits = bm25.get_top_n(query.split(), corpus, n=k)
    candidates = dedupe(dense_hits + sparse_hits)
    pairs = [(query, c.text) for c in candidates]
    scores = reranker.predict(pairs)
    ranked = sorted(zip(candidates, scores), key=lambda x: -x[1])
    return [c for c, _ in ranked[:5]]

Enter fullscreen mode Exit fullscreen mode

Why this matters: in financial, legal, and medical use cases, missing a specific code or term means missing the entire answer. Pure semantic search misses these constantly. Hybrid + rerank fixed this for a healthcare client managing 10,000+ patient records.

Failure 4: Multimodal blindspots

Most RAG systems can't read the charts, diagrams, screenshots, or tables inside PDFs. They OCR the text and lose 40% of the information.

If your domain has visual content — research papers, technical docs, medical scans, financial reports — text-only RAG is broken by design.

The fix: vision-language embeddings (ColPali, CLIP) for image regions alongside text chunks. Index both. Let the retriever match queries against both modalities.

from colpali_engine.models import ColPali, ColPaliProcessor

processor = ColPaliProcessor.from_pretrained("vidore/colpali")
model = ColPali.from_pretrained("vidore/colpali")

def embed_page_image(pdf_page_image):
    inputs = processor(images=[pdf_page_image], return_tensors="pt")
    return model(**inputs).last_hidden_state.mean(dim=1)

# Store both text embeddings AND image embeddings in the same vector store
# with a 'modality' tag. Retrieve from both, then merge.

Enter fullscreen mode Exit fullscreen mode

I built this for a research firm searching 10,000+ pages of mixed-content PDFs. Asking "show me the Q3 conversion funnel chart" actually returns the right chart now. Full writeup: Multimodal RAG with ColPali & CLIP.

Failure 5: No evaluation harness = no improvement

Most teams ship RAG without an evaluation pipeline. Then when accuracy degrades, they can't tell:

  • Did retrieval get worse?
  • Did the LLM get worse?
  • Did the data get harder?
  • Was it always this bad and we just didn't notice?

You can't fix what you can't measure.

The fix: a golden dataset + automated nightly eval. 50–100 hand-curated question/answer pairs covering your edge cases. Run them through the system every deploy. Track three metrics:

def evaluate_rag(golden_dataset, rag_system):
    results = {
        "retrieval_hit_rate": 0,    # did retrieval find the right doc?
        "answer_correctness": 0,    # did the final answer match?
        "faithfulness": 0,          # was the answer grounded in retrieved docs?
    }
    for q, expected_doc_ids, expected_answer in golden_dataset:
        retrieved = rag_system.retrieve(q)
        answer = rag_system.answer(q)
        results["retrieval_hit_rate"] += any(d.id in expected_doc_ids for d in retrieved)
        results["answer_correctness"] += llm_judge(answer, expected_answer)
        results["faithfulness"] += llm_judge_grounding(answer, retrieved)
    return {k: v / len(golden_dataset) for k, v in results.items()}

Enter fullscreen mode Exit fullscreen mode

This is the single highest-leverage thing you can build. Every RAG improvement I've shipped started with one of these metrics moving in the wrong direction.

The Pattern: Design for failure on day 1

If I had to compress all 20 RAG projects into one sentence: the production-ready systems are the ones designed for failure from the first commit. Self-correction loops, hash-based incremental indexing, hybrid retrieval, multimodal embeddings, and an evaluation harness aren't optimizations you add later — they're load-bearing infrastructure.

Most "AI demos that broke in production" stories are really "demos without failure handling that met production." The fix isn't a smarter model. It's better architecture.

If you're building a RAG system that needs to survive real data, look at every component and ask: what happens when this fails? If you don't have an answer, that's the next thing to build.


About the Author

I'm Muaz Ashraf, a freelance AI engineer specialising in production-ready RAG systems, AI agents, and AI integration. I've shipped 20+ AI systems across 7 countries with a 100% project completion rate.

Open for AI consulting, RAG system development, AI agent development, and LLM application work. Typical MVP delivery: 2–4 weeks.

If you found this useful, follow me here on dev.to — I publish field notes from real production AI work.