Language models know a great deal, but they do not automatically know your latest policies, product catalogue, contracts, or internal procedures. Retrieval-augmented generation (RAG) solves this by finding relevant company information before the model writes an answer.
The RAG pipeline
- Ingest: collect documents from approved sources.
- Parse: extract useful text, tables, headings, and metadata.
- Chunk: split content into meaningful, retrievable units.
- Embed: convert chunks into vectors that capture semantic meaning.
- Retrieve: find candidates for each user question.
- Rerank: select the most relevant evidence.
- Generate: ask the model to answer using that evidence.
- Cite: link the response back to source material.
Architecture decisions that matter
Chunking should follow document structure rather than arbitrary character counts. Metadata should include source, owner, date, department, and permissions. Hybrid retrieval—semantic plus keyword search—often performs better for product codes, names, and exact policy terms.
Security is part of retrieval
Never retrieve a document the user is not allowed to see. Permission filters must be applied before evidence reaches the model. Encrypt stored data, log access, and define retention rules for prompts and responses.
Evaluate the system
Create a test set from real questions. Measure retrieval relevance, answer correctness, citation quality, unsupported claims, latency, and cost. Review failure patterns by category; a single average score can hide serious weaknesses.
question → permission filter → hybrid retrieval → reranking → grounded prompt → cited answer
Reliable RAG is an information system, not just a prompt. Its quality depends on content governance, search engineering, evaluation, and user experience.
