A RAG application can work perfectly during a demo and still fail when real users start depending on it.
Imagine an enterprise building an internal AI assistant. Employees use it to search company policies, technical documentation, customer records, and operational reports. During testing, the assistant retrieves relevant documents and generates convincing answers.
A few weeks after deployment, things start going wrong.
A newly updated policy is not appearing in search results. Some questions return irrelevant documents. Exact product identifiers are missed, citations point to the wrong pages, and response times increase as the knowledge base grows.
The language model has not necessarily become worse. The problem is that everything around it was designed for a prototype rather than a production workload.
This is where RAG engineering becomes much more interesting.
A production-ready RAG system is not simply an LLM connected to a vector database. It is a complete information pipeline that must ingest changing data, retrieve relevant evidence, enforce permissions, generate grounded answers, and continuously prove that it is working correctly.
Building one requires understanding every stage, from the moment a document enters the system to the moment an answer reaches the user.
Understanding the Architecture of a Production RAG Pipeline
Before looking at individual components, it helps to separate a RAG system into two independent but connected pipelines.
The ingestion pipeline prepares organizational information so that it can be searched. It handles document extraction, preprocessing, chunking, embedding generation, metadata, and indexing.
The query pipeline processes user questions, retrieves relevant information, reranks the results, assembles the context, and generates the final answer.
The complete architecture looks like this:
Ingestion pipeline:
Documents → Parsing → Cleaning and Enrichment → Chunking → Embeddings → Vector and Keyword Indexes
Query pipeline:
User Query → Query Processing → Hybrid Retrieval → Reranking → Context Assembly → LLM → Grounded Answer with Citations
Both pipelines need additional components for authorization, monitoring, error handling, data synchronization, and evaluation.
Keeping these responsibilities separate makes the system easier to scale. Document processing can happen asynchronously in the background, while user requests follow a latency-sensitive retrieval and generation path.
AWS also recommends separating document ingestion from query processing in its production RAG architecture guidance. This helps teams scale and troubleshoot the two workloads independently.
1. Document Ingestion: Build a Reliable Knowledge Pipeline
Every RAG system starts with information.
That information might come from PDF files, Word documents, HTML pages, internal knowledge bases, cloud storage, databases, product documentation, or company management systems.
The first responsibility of the ingestion pipeline is to transform these different sources into information that can be searched consistently.
However, simply extracting text from a document is not enough.
Consider a financial report containing headings, tables, numerical values, and footnotes. A basic PDF parser might extract the text but lose the relationship between a table's column headings and its values.
The resulting text may look readable while no longer preserving the information needed to answer questions correctly.
A reliable ingestion pipeline should therefore handle several operations.
Document parsing: Extract text and structural elements from the original source. For scanned PDFs, this may require OCR. Tables, images, diagrams, and complex layouts may need specialized extraction methods.
Normalization: Remove unnecessary formatting, repeated headers, irrelevant footer content, and extraction artifacts without destroying meaningful information.
Metadata enrichment: Attach document identifiers, source URLs, version numbers, page numbers, sections, timestamps, and access-control information.
Deduplication: Detect duplicate or nearly identical documents to avoid filling the index with repeated content.
Document validation: Reject corrupted files, unsupported formats, empty documents, and content that fails ingestion checks.
A particularly important decision is preserving the original document and its source information.
Do not treat the extracted text as the only copy of your data. Keep a connection to the original source so that the application can verify information, display citations, and process future updates correctly.
Ingestion must handle changes, not just uploads
One of the biggest differences between a prototype and a production system is how document changes are handled.
Production knowledge bases are constantly evolving.
Documents are uploaded, replaced, edited, and deleted. Permissions change, and some sources become unavailable.
A one-time ingestion script cannot handle this reliably.
A better architecture uses event-driven processing:
- A document is added or modified in its source system.
- The application records a document-change event.
- A background worker processes the document.
- The updated content is extracted and indexed.
- Processing failures are retried and recorded.
The same workflow must support deletions and permission changes.
For reliability, ingestion operations should be idempotent. Processing the same document event twice should not create duplicate chunks or inconsistent index entries.
Use document hashes or version identifiers to identify which source content actually changed. This also avoids regenerating embeddings when a document has not changed.
AWS's production RAG guidance and Databricks' unstructured data pipeline documentation both emphasize automated ingestion, preprocessing, metadata enrichment, and handling changing document collections.
2. Chunking: Turn Large Documents into Useful Retrieval Units
After extracting and cleaning document content, the next challenge is deciding how much information should be stored in a single retrieval unit.
This process is called chunking.
Embedding an entire 200-page document as one representation makes it difficult to retrieve only the information relevant to a specific question.
At the other extreme, splitting every sentence into a separate chunk can destroy the context required to understand an answer.
Consider an employee handbook containing the following information:
- Leave eligibility
- Annual leave allowance
- Carry-forward rules
- Leave approval procedures
- Exceptions for different employee categories
Suppose an employee asks:
"How many unused annual leaves can I carry forward?"
A useful retrieval result should contain the carry-forward rule, along with the eligibility conditions that explain when it applies.
If the chunking process separates the rule from its heading or qualifying conditions, the retriever may return incomplete information.
This is why chunking should preserve meaning, not simply divide text into equally sized pieces.
Fixed-size versus structure-aware chunking
Fixed-size chunking divides text according to a configured token limit, sometimes with overlapping content between consecutive chunks.
It is relatively straightforward and can work well for simple documents.
However, it does not understand the document's structure. A chunk may start halfway through a paragraph, combine unrelated sections, or separate a table from its explanation.
Structure-aware chunking uses document boundaries such as headings, paragraphs, sections, tables, and code blocks to create more meaningful retrieval units.
For a technical document, the hierarchy might look like:
Document → Chapter → Section → Subsection → Individual Chunk
This preserves relationships between the content and its original context.
There is also a useful technique called parent-child chunking.
The child chunk contains a smaller, focused passage for precise retrieval. The parent represents a larger section that can be supplied to the LLM when additional context is necessary.
For example, the retriever might find a paragraph containing a specific refund condition, while the generation stage receives the complete refund-policy section to understand its exceptions.
What about chunk size and overlap?
There is no universally correct chunk size.
A technical manual, a legal agreement, a support conversation, and a product catalog have different structural requirements.
Larger chunks preserve more context but can introduce irrelevant information. Smaller chunks offer greater retrieval precision but may lose relationships between important statements.
Overlap can help prevent information near chunk boundaries from being separated, but excessive overlap creates redundant vectors, increases storage and embedding costs, and may return nearly identical search results.
The right settings should be determined through retrieval evaluation using actual application queries.
Preserve metadata at the chunk level
Every chunk should retain enough information to identify its original source.
Useful metadata includes:
| Field | Purpose |
|---|---|
| document_id | Identifies the original document |
| chunk_id | Uniquely identifies the chunk |
| document_version | Tracks content revisions |
| section_title | Preserves document context |
| page_number | Supports source citations |
| source_url | Links to the original document |
| tenant_id | Supports tenant isolation |
| access_control | Preserves document permissions |
| updated_at | Supports freshness management |
This metadata becomes essential when implementing filters, citations, document updates, and access control.
Databricks' RAG data pipeline guidance and AWS's chunking recommendations both emphasize preserving document structure rather than relying exclusively on arbitrary text boundaries.
3. Embedding Generation: Give Documents a Searchable Representation
Once documents have been divided into meaningful chunks, the system needs a way to search them based on meaning rather than just matching identical words.
This is where embedding models become important.
An embedding model converts text into a numerical vector that represents semantic relationships.
For example, consider two sentences:
- "How can I recover access to my account?"
- "What should I do if I forget my password?"
The wording is different, but the underlying intent is similar.
A good semantic retrieval system can recognize this relationship even when the sentences do not share many exact keywords.
During ingestion, the application generates an embedding for each chunk and stores it alongside the original text and metadata.
During a user request, it generates an embedding for the query and searches for nearby document vectors.
Choosing an embedding model
The embedding model directly affects retrieval quality.
A model that performs well on general English text may not perform equally well on legal documents, source code, medical terminology, or specialized enterprise vocabulary.
Evaluate candidate models using representative query-document pairs instead of selecting one only because it has more dimensions or a newer release.
Consider:
- Retrieval quality on your actual dataset.
- Language and domain support.
- Maximum input length.
- Embedding generation latency.
- Infrastructure and API cost.
- Deployment and data privacy requirements.
One important implementation rule is to keep the document and query embedding configurations compatible.
Some models use different instructions or prefixes for document embeddings and query embeddings. Follow the model's intended usage rather than assuming the same encoding procedure applies to both.
Also record the embedding model and its version. A future model change may require re-embedding the document collection and rebuilding or updating the index.
Vector storage is not the entire search solution
The vector database stores embeddings and supports similarity search, but the application also needs the original chunk text, source metadata, and permissions.
A retrieval result should provide enough information to identify the source document and reconstruct the context required for generation.
For production applications, a vector index is part of a larger search system, not a replacement for the original document store.
4. Hybrid Search: Combine Semantic Understanding with Exact Keyword Matching
Pure vector search is useful, but it has an important limitation.
Semantic similarity does not always capture the exact information a user is looking for.
Imagine someone asks:
"What is the refund policy for order A39281?"
The exact order identifier is important. A semantic embedding may understand the general meaning of the question but fail to prioritize the exact identifier.
The same issue appears with:
- Product codes
- Invoice numbers
- Employee IDs
- API names
- Error codes
- Technical identifiers
- Specific legal terms
Traditional keyword search is often better at matching these exact terms.
This is why production retrieval systems frequently use hybrid search.
Hybrid search combines two retrieval approaches:
Dense vector search: Finds semantically related content, even when the query and document use different wording.
Sparse or keyword search: Finds documents based on exact terms and token-level matches, often using BM25 or a similar ranking method.
Both searches can run in parallel against the same request.
Their result lists are then combined to create a unified candidate set.
Why use Reciprocal Rank Fusion?
Dense retrieval and keyword retrieval generally produce different ranking scores. Their raw scores should not automatically be compared or added together.
Reciprocal Rank Fusion (RRF) provides a way to combine rankings using the positions of results in their respective lists.
A simplified RRF calculation is:
[ RRF(d)=\sum_{r \in R}\frac{1}{k+rank_r(d)} ]
Here:
- (d) is a document.
- (R) represents the different retrieval result lists.
- (rank_r(d)) is the document's position in one result list.
- (k) is a ranking constant.
A document that ranks highly in multiple retrieval lists receives a stronger combined score.
For example, a document may rank first in keyword search and third in vector search. Another document may rank tenth in both.
RRF helps promote documents that perform consistently across retrieval strategies.
Microsoft Azure AI Search documents this approach for combining parallel text and vector queries, while Cloudflare AI Search also supports hybrid retrieval with RRF.
Hybrid search is especially useful for enterprise knowledge bases where users mix natural-language questions with exact identifiers and technical terminology.
However, it is not automatically necessary for every application. Benchmark it against simpler retrieval to determine whether the additional complexity improves results.
5. Reranking: Put the Most Relevant Evidence First
Hybrid search can retrieve a strong set of candidate documents, but the first result is not necessarily the best result.
This happens because the initial retrieval stage is designed to search a large collection efficiently.
Its job is to find promising candidates, not always to make the final relevance decision.
This is where reranking improves the pipeline.
A reranker receives the user's query and the candidate document chunks, then evaluates how relevant each candidate is to that particular query.
It produces a new ranking based on this deeper comparison.
How is reranking different from vector search?
A typical embedding-based retriever independently encodes the query and document, then compares their vector representations.
A cross-encoder reranker takes the query and candidate document together as an input pair.
Because it examines their interaction directly, it can make a more detailed relevance judgment. This generally costs more computation and latency, so it is applied only to a relatively small candidate set.
For example:
A hybrid retriever searches thousands of documents and returns 30 candidates.
The reranker compares those 30 candidates against the original question and places the strongest evidence at the top.
The application then selects a smaller set for context assembly.
The result is a two-stage retrieval strategy:
- Candidate retrieval: Search broadly and efficiently.
- Precision ranking: Examine the candidates more deeply and select the most useful evidence.
Reranking is not a substitute for good retrieval. If the correct document never enters the candidate set, the reranker cannot recover it.
It also introduces additional latency and model costs. The number of candidates should be selected through measurement rather than increased without limit.
Microsoft's Azure architecture guidance describes the accuracy-versus-latency trade-off of cross-encoder reranking. Cohere's reranking documentation also explains how rerankers improve the ordering of results from existing keyword, vector, and hybrid search systems.
6. Context Assembly: Give the LLM Evidence It Can Actually Use
After retrieval and reranking, the application has a collection of relevant chunks.
But there is another important decision: which parts should actually be passed to the language model?
A common mistake is to send every retrieved chunk directly into the prompt.
More context does not automatically produce better answers.
Large amounts of irrelevant information can distract the model, increase token costs, consume context-window capacity, and introduce conflicting statements.
Instead, the application should construct a focused context.
A good context assembly stage should:
Remove duplicates: Multiple chunks may contain repeated paragraphs or overlapping information from the same document.
Preserve relationships: Include surrounding sections when a retrieved passage depends on another paragraph, condition, or definition.
Respect the context budget: Select enough evidence to answer the question without unnecessarily filling the context window.
Prioritize relevant information: Place the most useful evidence where it can be easily understood by the model.
Maintain provenance: Keep every chunk connected to its source and document version so that citations can be generated correctly.
There is also a useful distinction between retrieval and generation.
Retrieval identifies potentially relevant evidence. Context assembly decides what the LLM should actually see.
These should not be treated as the same operation.
Tell the model what to do when evidence is insufficient
A reliable application must handle questions that cannot be answered from its knowledge base.
Suppose a user asks about a refund policy, but the retrieved documents contain no information about refunds.
The model should not fill the gap using general knowledge or produce an answer that sounds confident.
The generation instructions should explicitly establish that retrieved content is the evidence source, that unsupported claims must not be invented, and that insufficient evidence should result in an appropriate response.
This is essential for enterprise applications where an incorrect answer can affect financial decisions, legal processes, customer commitments, or internal operations.
7. Citations: Make Every Important Answer Verifiable
Generating an answer is useful. Being able to verify where that answer came from is even more important.
In many enterprise environments, users need to know which document supports an answer before acting on it.
A RAG system should therefore return source references alongside its generated response.
For example, an answer about employee leave policy might reference:
- Employee Handbook, Section 4.2
- Leave Policy, Page 18
- Document Version 3.2
This allows the employee to inspect the original information rather than trusting an AI-generated response blindly.
However, citations need to be designed into the pipeline.
Simply asking an LLM to provide source references does not guarantee that those references are genuine.
A model may invent a page number, attach the wrong document to a statement, or cite a retrieved document that does not actually support its answer.
How should reliable citations work?
Each indexed chunk should retain its original document identifier, page number, section, source URL, and version.
When retrieved content enters the generation stage, its source identifier should also be preserved.
The model can then reference the supplied source identifiers when generating an answer.
The application should map those identifiers back to the original documents and validate that the cited sources were actually included in the evidence provided to the model.
For higher-assurance applications, check whether the cited passage supports the associated factual statement rather than merely checking that the document exists.
This creates a more reliable relationship:
Generated claim → Supporting passage → Original document
Citations should be treated as evidence metadata, not decorative links added after generation.
OWASP's RAG security guidance emphasizes source attribution and provenance as important controls for making responses auditable.
8. Evaluation: Measure the Pipeline Before Trusting Its Answers
This is arguably the most important stage of a production RAG system.
A system can return fluent, well-written answers while retrieving the wrong documents.
It can also retrieve excellent documents but fail to use them correctly during generation.
Looking at a few successful responses is not sufficient to prove that a RAG system is reliable.
You need a repeatable evaluation process.
Build a representative evaluation dataset
Start by collecting real questions that users are likely to ask.
For every question, identify the expected relevant documents and, where possible, the expected answer and supporting evidence.
Include difficult cases:
- Queries that use different wording from the source document.
- Questions containing exact product IDs or technical identifiers.
- Questions that require information from multiple documents.
- Questions with ambiguous wording.
- Questions for which no answer exists.
- Questions involving restricted documents.
This creates a consistent benchmark for comparing changes to chunking, embedding models, hybrid retrieval, reranking, and generation prompts.
Evaluate retrieval quality separately
Retrieval metrics tell you whether the system is finding the right evidence.
Recall@K: Measures how many relevant documents appear within the top K retrieved results. It helps identify whether the search system is missing important information.
Precision@K: Measures how many retrieved results in the top K are actually relevant. It helps identify whether the system is returning too much irrelevant content.
Mean Reciprocal Rank (MRR): Measures how high the first relevant result appears. It is useful when the first useful result has particular importance.
nDCG@K: Evaluates the ordering of retrieved results while accounting for different levels of relevance.
These metrics help diagnose retrieval problems before they become answer-generation problems.
Evaluate the generated answers too
Finding relevant documents does not guarantee a correct answer.
You should also measure:
| Metric | What it evaluates |
|---|---|
| Faithfulness | Whether the response is supported by retrieved context |
| Answer relevance | Whether the response addresses the user's question |
| Context precision | Whether retrieved chunks are relevant and well-ranked |
| Context recall | Whether the retrieved context contains the necessary information |
| Answer correctness | Whether the final answer is factually correct |
| Citation accuracy | Whether cited sources genuinely support the claims |
Frameworks such as Ragas provide metrics for evaluating retrieval quality, response relevance, and faithfulness. They can help automate parts of the evaluation process, although LLM-based evaluation should still be calibrated against human-reviewed examples.
A useful evaluation strategy combines automated metrics, human review, and real user feedback.
Never optimize a RAG system using only answer quality scores. You need to understand whether an improvement came from better retrieval, better context, or better generation.
9. Security: Protect the Knowledge Before It Reaches the LLM
RAG introduces a new security boundary because the application retrieves information from external sources and places that information inside the model's context.
This creates several risks that ordinary API security alone cannot address.
Enforce permissions during retrieval
If different employees or customers have access to different documents, every indexed chunk must retain its authorization metadata.
The system should derive the user's identity and permissions from trusted application data and apply authorization filters before retrieving content.
Do not rely on the model to decide whether a user is allowed to see a document.
Treat retrieved documents as untrusted input
A document can contain malicious instructions, whether intentionally or accidentally.
For example, an uploaded document might contain hidden text telling the AI assistant to ignore previous instructions or reveal confidential information.
This is a form of indirect prompt injection.
The application must clearly separate trusted system instructions from retrieved content. Retrieved documents should be treated as data, not commands.
Input validation, source provenance, content inspection, context boundaries, and output controls should all be part of the security design.
Protect document updates and deletion
When a document is deleted or access is revoked, its chunks, indexes, and cached results must be handled appropriately.
Otherwise, information that should no longer be accessible may continue appearing in search results.
OWASP's RAG Security Cheat Sheet covers document poisoning, indirect prompt injection, chunk-level access control, source provenance, cache isolation, and retrieval security.
For enterprise systems, these controls should be part of the initial architecture rather than added after a data leak occurs.
10. Deployment: Turn the RAG Pipeline into a Reliable Service
A RAG application should not depend on one large synchronous process that performs every operation.
Document ingestion and user-facing queries have very different workloads.
Ingestion may involve extracting large PDFs, processing thousands of chunks, and generating embeddings in batches. User queries, on the other hand, need predictable response times.
Separating these workloads makes the application easier to operate.
Asynchronous ingestion
Use background workers to process document events.
A message queue can absorb sudden upload spikes, distribute work among multiple workers, and isolate document-processing failures.
If a document fails during extraction or embedding generation, the worker should retry it without blocking unrelated documents.
Use exponential backoff, timeouts, dead-letter queues, and structured error logging.
A corrupted PDF should not bring down the entire ingestion pipeline.
Scale the query path independently
The user-facing path should be optimized for latency.
Its responsibilities include authentication, query embedding, authorized retrieval, hybrid result fusion, reranking, context construction, and generation.
Each stage should have its own timeout and performance measurements.
For example, a slow embedding provider should not cause unlimited requests to accumulate inside your application.
Use sensible concurrency limits, request timeouts, retry policies, and circuit breakers where appropriate.
Also consider graceful fallback behavior. When retrieval or generation is unavailable, return an explicit error or an appropriate unavailable response rather than generating an answer from unsupported information.
Use versioned indexes and controlled deployments
Changes to chunking rules, embedding models, metadata structures, and retrieval parameters can all affect search results.
Treat index updates as deployable changes.
A versioned index allows the team to build a replacement, run evaluation, compare results, and switch traffic when the new version is ready.
Keep the previous index available until the replacement has passed production checks.
This reduces the risk of a retrieval change turning into a customer-facing outage.
Monitor the entire request lifecycle
Traditional infrastructure monitoring tells you whether services are healthy. It does not tell you whether the AI system is producing useful answers.
A production RAG application should track:
- Document ingestion success and failure rates.
- Number of indexed and outdated documents.
- Embedding generation latency and cost.
- Retrieval and reranking latency.
- Retrieved document and chunk identifiers.
- LLM token usage and response latency.
- Citation validity and answer quality.
- Retrieval errors and unsupported-answer frequency.
Use distributed tracing or request-level correlation IDs to follow a request through every stage.
Also protect sensitive information in logs. Record enough metadata to investigate failures without automatically storing raw user queries, confidential documents, or complete model contexts.
A request trace should help answer a practical question: When the model gives a wrong answer, was the problem in the source data, retrieval, reranking, context assembly, or generation?
AWS's production RAG guidance recommends monitoring retrieval quality in addition to infrastructure health, alongside retries, timeouts, dead-letter queues, and idempotent ingestion.
11. Common Mistakes That Prevent RAG Systems from Reaching Production
Treating chunking as a fixed configuration
Copying a chunk size from another project does not guarantee good retrieval. Chunk boundaries should reflect the structure and content of your documents.
Using only vector similarity
Semantic search is not always good at finding exact identifiers, codes, and product names. Evaluate hybrid retrieval when these matter.
Sending too many chunks to the LLM
More context can increase cost and introduce irrelevant information. Focus on relevance and evidence quality rather than maximizing the number of retrieved chunks.
Ignoring document versioning
Without version tracking, updated documents can leave stale chunks in the index. This can cause the assistant to return outdated information even when the original document has changed.
Generating citations without validation
A citation that points to an unrelated source creates false confidence. Validate the connection between claims and source passages.
Skipping evaluation until after deployment
Without a baseline dataset, developers cannot reliably determine whether changes to embeddings, chunking, or retrieval have improved the system.
Ignoring retrieval security
A technically accurate answer can still be a serious failure if it contains information the current user is not authorized to access.
Monitoring only API errors and server uptime
A healthy application can still return consistently poor answers. Retrieval quality and answer groundedness need their own monitoring.
12. What Does a Production-Ready RAG Architecture Actually Look Like?
Putting everything together, a reliable architecture has two main paths surrounded by shared security and observability controls.
Ingestion path
Data Sources → Event Queue → Document Parsing → Cleaning and Enrichment → Structure-Aware Chunking → Embedding Generation → Vector and Keyword Indexing
Query path
User Request → Authentication and Authorization → Query Processing → Hybrid Search → Reranking → Context Assembly → LLM Generation → Validated Citations → Response
Shared infrastructure
- Access control and tenant isolation.
- Document versioning and deletion management.
- Retry handling and failure recovery.
- Evaluation and regression testing.
- Logging, tracing, and cost monitoring.
- Encryption, retention policies, and audit records.
The exact infrastructure may use PostgreSQL with pgvector, OpenSearch, Qdrant, Weaviate, Azure AI Search, or another search platform.
The technology choice matters, but the architecture matters more.
A well-designed pipeline can be implemented across different infrastructure stacks. What cannot be skipped are the responsibilities that make it reliable.
Production RAG Readiness Checklist
Before exposing a RAG application to real users, verify the following:
- Documents can be ingested and updated automatically.
- Parsing preserves important document structure.
- Chunking maintains meaningful context.
- Every chunk retains source and version metadata.
- Embeddings use a consistent model configuration.
- Retrieval supports relevant metadata filters.
- Hybrid search has been evaluated where appropriate.
- Reranking improves relevance enough to justify its cost.
- Answers are grounded in retrieved evidence.
- Citations can be traced to original documents.
- Unsupported questions are handled safely.
- Document permissions are enforced before retrieval.
- Updates and deletions are synchronized.
- Retrieval and generation are evaluated independently.
- Ingestion failures can be retried without duplication.
- Latency, cost, and retrieval quality are monitored.
- Index changes have a tested rollback strategy.
Final Thoughts
Building a RAG prototype is relatively easy. Making it dependable under real production workloads is a different engineering challenge.
The quality of a RAG system does not come from the language model alone. It depends on how accurately the application understands its documents, how intelligently it divides and indexes information, how effectively it retrieves evidence, and how carefully it controls what reaches the model.
A stronger embedding model cannot compensate for corrupted document extraction. A sophisticated reranker cannot recover information that never entered the candidate set. And an excellent LLM cannot reliably answer a question when the correct evidence is missing.
This is why production RAG should be approached as a complete information-retrieval system rather than a simple AI integration.
Build the data pipeline carefully. Make retrieval measurable. Preserve source evidence. Enforce security at every stage. Then let the language model do what it does best: turn relevant information into useful answers.
That is what separates a convincing RAG demo from a production system that people can actually depend on.



