HAVE AI NEWS HAVE AI NEWS
tg subscribe
Tools

Why Enterprise RAG Degrades in Production and How to Bring the Assistant Back to Life

Why Enterprise RAG Degrades in Production and How to Bring the Assistant Back to Life

We analyze the key reasons RAG systems fail on real-world data—from fatal chunking mistakes to cluttered knowledge bases—and build a robust hybrid search pipeline.

The illusion of RAG being production-ready is a classic problem in enterprise development. At the prototype stage, working with a small volume of curated documents, the system demonstrates impressive accuracy. However, once integrated with an actual corporate knowledge base—where duplicates, contradictions, and obsolete policies have accumulated for years—the quality of answers rapidly degrades. In most cases, the culprit is not the language model and its notorious hallucinations, but architectural missteps in data preparation and retrieval.

Core Architecture: Classic vs. Agentic

Attempting to deploy a complex agentic pipeline right from the start is a common mistake. Agentic loops, where the model independently decides on a retrieval strategy and performs multiple iterations, increase response latency, inflate token costs, and complicate debugging.

Experience shows that about 80% of user queries are trivial and can be resolved using a classic single-pass RAG. The optimal approach relies on a hybrid model:

  • A lightweight classifier-router assesses the complexity of the incoming query.
  • Standard questions follow a direct, deterministic path.
  • Complex multi-part queries are directed to an agentic loop with evaluation of intermediate results.

Secrets of Data Preparation and Indexing

No advanced generation algorithm can fix the output if the data preparation stage was done improperly.

Chunking Pitfalls

Splitting documents requires accounting for language nuances and domain specifics. Overly small chunks (e.g., around 100 tokens) break semantic relationships, turning technical manuals or formulas into disconnected noise. Optimal guidelines for text chunking include:

  • FAQ-style databases: around 200 tokens (the question and answer should reside within a single chunk).
  • Coherent articles in Russian: around 1,000 tokens on average, with an overlap of about 10% to preserve context across block boundaries.
  • Complex layouts (tables, cross-cutting diagrams): semantic boundary segmentation using an LLM, despite higher indexing costs.

Choosing a Search Engine

Relying solely on semantic vectors is risky: dense vector search can miss specific terminology, part numbers, or personal names. The best stability is achieved by combining two approaches:

Index TypeMechanismStrengths
SemanticDense vectors (OpenAI text-embedding-3-large for cloud or BGE-M3 for on-premise)Understands tone, synonyms, and overall query context.
Full-textSparse vectors (BM25 algorithm)Exact matching of terminology, codes, and keywords.
GraphEntity and relationship extraction via LLMEffective for multi-hop queries, but extremely expensive and complex to maintain.

Complex graph structures (“the path through Mordor”) should only be introduced once the potential of combining vector and full-text search is completely exhausted.

Retrieval Pipeline and Top-N Traps

A typical fault-tolerant pipeline includes rewriting the initial user turn (taking into account the last k history messages), hybrid retrieval, and subsequent list merging using the Reciprocal Rank Fusion (RRF) algorithm. The selected top candidates (e.g., 10 chunks) pass through a cross-encoder reranker, which filters out irrelevant fragments and feeds the top 3–5 chunks to the generator.

However, fixed Top-N retrieval introduces hidden vulnerabilities:

  1. Heuristic threshold: A chunk containing the critical answer might rank at N+1 and fail to enter the context.
  2. Duplicate clustering: Semantic search fills the top results with semantically similar chunks without evaluating their marginal informativeness.
  3. Broad context blindness: The system cannot answer high-level summary questions (“What is this documentation about?”) because it operates strictly on fragments.

Diagnostics and Quality Control in Production

When an assistant begins producing incorrect answers, isolate the issue strictly step-by-step: first, verify whether the necessary chunk was included in the reranker's output. If the chunk is present, look for the issue in the prompt and temperature (which should be close to zero for factual accuracy). If the document is missing from the retrieved set, tune the retrieval engine, clean query noise, or isolate data domains.

Splitting storage into domain-specific partitions (e.g., dedicated indexes for HR, IT, and accounting) prevents context bleed and boosts accuracy. For automated regression testing, use a combination of real user logs and LLM-as-a-judge methods with a graded scale from 1 to 10, whereas simple user thumbs up/down provide virtually no actionable data for engineering root-cause analysis.

Author: poslavskaya

Source: habr.com

Why RAG Breaks: An Analysis of 6 Critical Retrieval Errors and Recipes for a Reliable Architecture
Tools

Why RAG Breaks: An Analysis of 6 Critical Retrieval Errors and Recipes for a Reliable Architecture

Nearly three-quarters of AI agent failures are caused not by weaknesses in language models, but by errors during data retrieval. We examine RAG's hidden vulnerabilities and how to fix them.

How an AI Agent Works: The Anatomy of a System from Token Prediction to MCP
Tools

How an AI Agent Works: The Anatomy of a System from Token Prediction to MCP

We examine the inner workings of autonomous neural network agents: how a standard text generator gains hands, memory, and access to real-world tools, why context breaks down, and where the primary risks of automation lie.

From Smart Assistant to AI-Native: 5 Stages of AI Evolution in Corporate Processes
Business

From Smart Assistant to AI-Native: 5 Stages of AI Evolution in Corporate Processes

Most companies get stuck at the stage of launching simple bots, facing escalating costs and failures. We break down the five-level workflow transformation model—from personal assistants to end-to-end AI-Native systems.

Halving routine tasks and launching services in 7 days: practical outcomes of AI adoption in development
Business

Halving routine tasks and launching services in 7 days: practical outcomes of AI adoption in development

Real-world experience of integrating neural networks into construction fintech: how to automate 65% of incoming invoices, speed up code review to one minute, and set up self-healing automated tests.

Hebbia reports GPT-6 Astra gains in financial research
Models

Hebbia reports GPT-6 Astra gains in financial research

Hebbia says GPT-6 Astra improved source selection, citation relevance and presentation quality in tests based on financial research workflows.

M&T Bank’s Experience: How a Large-Scale IT Modernization Paved the Way for Generative AI for 15,000 Employees
Business

M&T Bank’s Experience: How a Large-Scale IT Modernization Paved the Way for Generative AI for 15,000 Employees

U.S. regional bank M&T Bank has deployed enterprise AI tools to most of its workforce. The impact is already visible in practice: call center interactions are processed six minutes faster per call.