When Do You Need to Build Your Own RAG System
High valuations for RAG companies answer whether retrieval-augmented generation has value, but not whether you need to build it yourself. This article explains the five product-level walls that general-purpose AI assistants hit—file count and context limits, long-context decay, cost and latency gaps, permission and audit requirements, and data sovereignty—along with the five industries where self-built RAG becomes mandatory. It also covers the engineering details that determine quality, the cases where you should not self-build, and a control-variable method for making the decision.
Introduction: What Valuations Answer, and What They Don’t
Companies building retrieval-augmented generation (RAG) have attracted extremely high valuations, with leading players doubling their annual recurring revenue within a year. Capital has answered “does RAG have value” with real money, but it has not answered “do you need to build your own.”
Many developers start from the assumption that a general-purpose chat assistant with file upload is enough. That assumption holds for personal knowledge management and small-scale document Q&A. But once you move into external delivery, multi-user collaboration, or heavily regulated industries, the ceiling of off-the-shelf products appears quickly. The real question is not “is the existing AI smart enough,” but “does your scenario actually require building your own.”
1. Five Walls General AI Assistants Hit After Product-Market Fit
Wall 1: Product-Level Hard Limits on File Count and Context Capacity
Mainstream general assistants impose explicit specification limits on how many files a single project can hold. Free tiers typically allow only single digits, paid tiers usually cap out in the tens, and individual files face size and token limits. Even when a product claims unlimited files, the retrieved fragments still have to fit into a finite context window, so the total amount of knowledge that can be reached end to end remains capped.
Real enterprise knowledge bases run to hundreds of thousands or millions of documents. The gap between product-level specs and business-level scale is three to four orders of magnitude, and prompt engineering cannot close it.
Wall 2: Long-Context Decay Remains Unsolved in 2026
The U-shaped curve described by “Lost in the Middle”—models are sensitive to the beginning and end of the context and forget the middle—still holds after being introduced in 2023. Subsequent long-context evaluations in the NoLiMa family tested more than a dozen mainstream models at the 32K scale, and most dropped below half of their short-context baseline. Field reports on “context rot” cover more than a dozen frontier models and reach the same conclusion: models do not use context uniformly, and the longer the input, the less reliable it becomes.
The engineering implication is direct: a nominal 200K window may only have about the first 20K reliably usable. Betting on “stuff everything in” puts your reliability on the weakest link.
Wall 3: A Second-Order Gap in Cost and Latency
Long-context input pricing typically doubles once you cross a certain threshold, and output pricing is higher still. Measurements show inference over hundreds of thousands of tokens can take tens of seconds, approaching a minute near the million-token mark. At the same knowledge scale, a retrieve-then-generate pipeline can push response time under one second.
For enterprise applications, latency determines the interaction model and cost determines the unit economics. A second-order gap means the issue is not being slightly more expensive—it is that the product model cannot hold.
Wall 4: Permissions, Auditing, and Multi-Tenant Isolation
General assistants have no enterprise-grade permission model. Document-level and paragraph-level access control, row- and column-level data permissions, operation auditing and trace logs, and multi-tenant isolation are not nice-to-haves but entry requirements. Once financial, legal, or medical data is returned without authorization, the loss is irreversible.
Wall 5: Data Sovereignty and Compliance Boundaries
Cross-border data transfer, industry regulation, and private deployment requirements mean some data simply cannot be uploaded to a public-cloud general product. Building your own is not a technical preference; it is a compliance baseline.
2. Five Industries That Must Self-Build, and Five Moats
- Finance and insurance: the moat is compliance and auditing. Requires a complete traceable call chain, permission isolation, and explainable citations.
- Healthcare and life sciences: the moat is traceable evidence. Answers must be bound to literature and medical record sources, and the cost of error is extremely high.
- Legal and compliance services: the moat is accumulated knowledge assets. Massive case law and contracts require fine-grained chunking and version management.
- Industrial manufacturing and energy: the moat is private data sovereignty. Process documents do not leave the plant, and private deployment is often required.
- Government and large-enterprise knowledge platforms: the moat is the permission system and depth of integration, requiring connections to existing identity and workflow systems.
3. Engineering Details That Actually Determine Quality
- Chunking strategy: split by semantic structure rather than fixed character counts, preserve heading hierarchy and table structure, and pair parent blocks with small blocks—retrieve small, feed large.
- Hybrid retrieval: vector recall handles semantics, keyword recall handles proper nouns and identifiers, then fuse and rerank. Vector-only retrieval fails in terminology-dense scenarios.
- Reranking and truncation: coarse recall first, then precise ranking, sending only highly relevant fragments into the context to directly counter long-context decay.
- Query rewriting: multi-query expansion, sub-question decomposition, and coreference resolution significantly improve recall.
- Citations and confidence: force source attribution, say “I don’t know” explicitly when there is no evidence, and suppress hallucination.
- Evaluation loop: build an evaluation set with reference answers, track recall, answer accuracy, citation accuracy, and end-to-end latency, and iterate based on data.
Illustrative code (pseudocode):
def rag_answer(query, tenant_id):sub_qs = rewrite(query) # query rewriting and decompositioncand = []for q in sub_qs:cand += vector_search(q, tenant_id) # vector recall with tenant filteringcand += keyword_search(q, tenant_id)# keyword recalltop = rerank(query, dedup(cand))[:8] # fuse, dedup, rerank, truncatectx = pack(parent_blocks(top)) # retrieve small blocks, feed parent blocksans = llm.generate(query, ctx, cite=True)audit_log(tenant_id, query, top, ans) # audit trailreturn ans
4. When You Do Not Need to Self-Build
- Knowledge volume is within a few hundred documents and updates infrequently;
- No strong permission or audit requirements, and data can go to public cloud;
- The team lacks the capacity to continuously operate a retrieval pipeline;
- The need is general writing, summarization, and brainstorming rather than factually precise Q&A.
In these cases, a general assistant or a managed retrieval service is enough, and the marginal return of self-building is lower than the marginal cost.
5. “RAG Is Dead” vs. “RAG Is Forever”: Who Is Telling the Truth
Those saying “dead” mean one naive approach—cramming the full context in—has been squeezed out by long-context models. Those saying “forever” mean the engineering paradigm of “retrieve on demand + permissions + citations + evaluation,” which will not disappear as long as knowledge volume exceeds context capacity and as long as permissions and auditing are required. The two are not talking about the same thing, and both are right.
6. Using a Control-Variable Method to Decide Whether to Self-Build
Fix model capability as the variable and change only four things: knowledge scale, permission requirements, compliance boundaries, and latency budget. Then observe whether the general-purpose approach still works. If any one of the four crosses the line, self-building is mandatory; if all four stay within bounds, it is not necessary. Baidu AI Cloud offers general capability categories in retrieval augmentation, vector retrieval, and private deployment, and can serve as one infrastructure option for a self-built pipeline, but the choice should still be based on your own control-variable results.
