back

What is RAG? How AI looks things up before it answers

written by

Emily Stone

tag

Data

date

08/10/2026

A general artificial intelligence model knows nothing about your company's private files. When an employee asks a general model about your parental leave policy, it answers from public internet text written during its training, not from your staff handbook. Retrieval-Augmented Generation, or RAG, solves this problem by looking up the right passages in your own documents before the system drafts an answer. Think of it as a research librarian fetching three exact pages from the archive and placing them on a writer's desk: the writer then summarises those pages instead of guessing from memory. The result is an assistant whose answers can rest on your own records rather than on general knowledge.

‍

Why general models cannot see your internal files

‍

Language models are trained on massive public datasets, meaning their fixed internal memory stops at their training cutoff and excludes private corporate intranets. You cannot expect a general model to know your travel expense limits, supplier agreements, or software manuals. A RAG system addresses this by operating in two distinct phases: first retrieving relevant external information from your knowledge base, and then generating the final response from that retrieved context. The prompt sent to the model combines the employee's original question, the retrieved document excerpts, and an instruction defining the expected tone and structure. Because the model reads the provided excerpts directly, it can answer specific company questions without needing any retraining.

‍

Direct document prompts versus retrieval pipelines

‍

Building an automated retrieval system is not always necessary. For a small collection of documents, under roughly 500 pages, it can be simpler to place the whole collection directly into the model's instructions rather than build a search step. When combined with prompt caching, which stores repeated text between calls, this direct approach can decrease operating costs by up to 90 percent and accelerate response times by more than two times. Teams should stay with direct prompts when all company reference material easily fits within that 500-page limit. When corporate documentation exceeds that volume, a full retrieval architecture becomes essential to locate and extract only the relevant passages.

‍

The five stages of a working retrieval system

‍

A working retrieval workflow moves documents through five clear operational stages:

‍

  1. Splitting. The system breaks long documents into short passages, often called chunks, so the search can find the exact paragraph that answers a question.
  2. Searching. When an employee submits a query, the system runs a search across all stored chunks. This retrieval step can use semantic search, which matches passages by meaning, keyword search, or structured database queries.
  3. Reranking. The first search results are scored again, often by a second model, so only the best passages go forward.
  4. Assembling. The best passages are combined with the employee's question and system formatting rules into a single prompt package.
  5. Answering. The model reads the passages and writes a reply, which can point to the documents it used.

‍

Consider a hypothetical internal human resources assistant. An employee asks: "How many weeks of paid parental leave do primary carers receive?" The system searches the employee handbook, pulls three paragraphs defining leave categories, reranks them to prioritise the parental leave section, and hands those excerpts to the model. The model reads the text and confirms the exact entitlement, referencing the section name directly.

‍

Naive implementations often isolate chunks without surrounding context. When a chunk states "employees receive twelve weeks" without mentioning the company name or the policy tier, the search mechanism frequently fails to identify it. Adding a brief summary of the source document to each chunk before indexing preserves the missing background, so the search tool recognises which organisation or policy each fragment belongs to. Following initial search with a reranking step then scores those retrieved passages against the question, discarding weak matches so only the most relevant excerpts reach the model.

‍

Where retrieval systems fail

‍

A retrieval pipeline can break down at any of three distinct stages: retrieving relevant data, augmenting context, or generating the response. Diagnosing an issue requires identifying which phase failed.

‍

Failure stageWhat you seeLikely cause
RetrievalMissing or irrelevant passagesThe search did not match the company's own wording, or exact product codes were missed by meaning-based search.
AugmentationOutdated or disjointed contextOld document versions remained in storage, or key facts were buried in the middle of long excerpts.
GenerationInvented facts or wrong toneThe model disregarded the passages it was given and invented details.

‍

We often find that what business leaders call "model hallucination" is really an earlier lookup failure. If the search step fails to deliver the current leave policy passage, the model may say it does not know, or guess from general knowledge.

‍

Checking the lookup on its own

‍

The simplest check needs no code. Write down ten common questions alongside the document and page that hold each answer. Ask each one, and look at the passages the system found before you read its reply. Count the lookup as correct only if the right passage is among the top three, then check that every fact in the reply traces to one of those passages. When the lookup reliably finds the right paragraphs, the answer step has what it needs to be accurate.

‍

Have a project in mind?

Let's map the potential impact together and identify how AI can drive revenue growth or cost savings for your business.

CONTACT US

Ready to talk?

Whether it’s a pilot or full-scale deployment, we’ll work with you to design the right solution.

CONTACT US
Check - Elements Webflow Library - BRIX Templates

Thank you

Thanks for reaching out. We will get back to you soon.
Oops! Something went wrong while submitting the form.