RAG explained: how AI chatbots answer from your own content

Retrieval-augmented generation in plain English: how RAG lets an AI chatbot answer from your content, the steps, what goes wrong, and how to make it accurate.

3 MIN READUPDATED 7 SECTIONS

Ask a general AI model about your returns policy and it will either say it doesn’t know or, worse, make something plausible up. It was never trained on your policy. Retrieval-augmented generation, usually shortened to RAG, is the method that fixes this, and it’s how almost every business chatbot answers from a company’s own content.

The idea was named in a 2020 paper by researchers at Facebook AI and UCL: combine a model’s language ability with a search over a separate set of documents, so answers are based on retrieved facts rather than only what the model memorised.

How RAG works, step by step

1. Preparing the content (indexing)

Your website pages, help articles, PDFs and Q&As are collected and split into passages, usually by heading. Each passage is converted into an embedding, a list of numbers representing its meaning, and stored with its title, URL and date. Many systems also keep a keyword index.

2. Finding the right passages (retrieval)

When a customer asks a question, the system converts the question the same way and finds passages with the closest meaning. Good systems combine meaning-based search with keyword search (“hybrid search”), so exact terms like product codes aren’t missed, then re-rank the results.

3. Writing the answer (generation)

The language model receives the question, the best few passages and instructions: answer only from these passages, cite them, and say if they don’t cover the question. It writes the answer in natural language, in the customer’s language.

4. Checking (in better systems)

Before the answer goes out, specific facts in it, such as prices, dates, time limits and amounts, are checked against the cited passages. Mismatches are corrected or the answer is withheld.

Why RAG rather than training the model

  • Current. Change a page and the next answer uses it. Retraining takes days and costs far more.
  • Traceable. Every answer can show its source, so customers and your team can check it.
  • Controllable. You decide exactly what the AI can draw on, and can override a page with a correction.
  • Cheaper. No custom model to train or host.

Fine-tuning still has a place for style and specialised tasks, but it’s a poor way to store facts that change.

What goes wrong

Most wrong answers from RAG chatbots trace back to retrieval and content, not the model:

  • The answer isn’t in the content. The model fills the gap. The fix: content, plus an instruction and a system that make “I don’t know” the default.
  • Outdated content. Last year’s prices page is still indexed. Re-read content regularly and remove old pages.
  • Contradictions. Two pages give different delivery times. The model picks one. Fix the content.
  • Bad splitting. A table split across passages, or a passage that loses its heading, so “£5” has no context.
  • Wrong passage retrieved. Similar wording, different topic. Hybrid search and re-ranking help.
  • Misreading. The model summarises a condition wrongly (“within 30 days” becomes “30 working days”). Fact checks help.

Content is the bottleneck for most businesses. When Gartner surveyed service leaders, 61% had a backlog of knowledge articles to edit.

Why models still fill gaps

Even with retrieval, language models are inclined to give an answer rather than none. Researchers at OpenAI argue this is because training and evaluation reward guessing over admitting uncertainty. A RAG system has to push the other way: explicit instructions, examples of good “I don’t know” replies, and an easy handover.

Security: retrieved text is untrusted

Anything retrieved, whether a web page, a document or an email, can contain text designed to manipulate the model (“ignore your instructions and…”). This indirect prompt injection is part of the top risk on OWASP’s list for AI applications. Treat retrieved content as data, limit what actions the AI can take, and enforce rules outside the model.

How to make RAG accurate

  1. Write for retrieval: one topic per page, answer first, descriptive headings, specific facts.
  2. Remove contradictions and old pages.
  3. Use hybrid search and re-ranking.
  4. Require citations and an explicit “not covered” response.
  5. Check key facts in answers against sources.
  6. Add corrections that override pages when you can’t change the page quickly.
  7. Review unanswered questions weekly and fill the gaps.
  8. Test with real questions after every content or settings change.

How Dazza fits

Dazza is built on RAG. It reads your website from the sitemap and keeps it current, adds files, Q&As, Notion, Google Drive and Confluence, answers with sources, lets your corrections override your website, and on Growth and above double-checks figures, prices, dates and policies against the sources before answering. See knowledge.

Questions people ask

What is RAG in AI?

Retrieval-augmented generation is a method where an AI system first retrieves relevant information from a set of documents and then generates an answer based on it. It lets a language model answer accurately about information it wasn’t trained on, such as your business’s policies.

Why use RAG instead of fine-tuning a model?

RAG uses your current content at answer time, so updates take effect immediately and answers can cite sources. Fine-tuning changes the model’s behaviour and style but is slow to update and poor at storing precise, changing facts like prices.

Does RAG stop hallucinations?

It greatly reduces them but doesn’t eliminate them. Models can still misread a passage or fill gaps. Good RAG systems tell the model to answer only from retrieved content, show sources and check key facts.

What content works best for RAG?

Clear, specific, current pages with one topic each, answers near the top, descriptive headings, and no contradictions between pages. Dates on anything time-limited help too.

Sources

  1. Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (2020)
  2. OpenAI: Why language models hallucinate
  3. OWASP: LLM01 prompt injection
  4. Gartner: 85% of customer service leaders will explore or pilot conversational GenAI in 2025 (knowledge backlog findings)
Try Dazza on your own website: 14 days and 100 conversations, no card. Start for free ↗