RAG is a mechanism in which, before the AI answers, it searches a set of predefined documents for the relevant parts and builds its answer from them. Its key advantage is that it can get closer to answers grounded in your own documents without retraining the AI.

"When I ask AI, it doesn't know anything about our company." "I want it to answer according to our internal rules." RAG is the name that comes up in situations like these. This article explains how RAG works, for first-time readers. It is not about whether to introduce a chatbot, but about what happens inside one.

What Is RAG?

A mechanism that lets AI "look things up before answering". It comes from the initials of the English term Retrieval-Augmented Generation.

  • Retrieval: finding the documents relevant to a question
  • Augmented: adding the documents found to the instructions given to the AI
  • Generation: having the AI compose an answer based on the added documents

Ordinary generative AI ( What Is Generative AI? answers using only the knowledge it had when it was trained. Technical explanations from major cloud providers also note that the data an AI has learned stays frozen, and that it can present incorrect information when it has no answer or present outdated information; RAG is described as one way to solve this ( Technical explanation from a major cloud provider, "What Is RAG (Retrieval-Augmented Generation)?").

What steps does RAG follow to produce an answer?

There are three steps: "prepare the documents → find the relevant parts → compose an answer with the documents attached." The technical explanation above describes roughly this same flow.

  1. Prepare the documents: store manuals, FAQs, and other documents that are acceptable as the basis for answers in a form the AI can easily search
  2. Find the relevant parts: when a question comes in, search the documents for the parts whose meaning is closest to the question
  3. Compose an answer with the documents attached: pass the parts found to the AI together with the question, and have it write an answer based on them

A blue-green diagram with the AMALINK logo and the heading "The Three Steps RAG Takes to Produce an Answer," showing three cards connected by arrows — 1 Prepare the documents (manuals, FAQs), 2 Find the relevant parts (where the meaning is closest to the question), 3 Answer with the documents attached (compose text based on the parts found) — with "Look it up, then answer" written below

What is searched here is not limited to places with the same wording. A common approach is to convert the documents into sequences of numbers in advance so that parts "close in meaning" to the question can be found.

Notes

Even with RAG, the AI is still the one composing the answer. It may misread the documents or add wording that is not in them. Keep up the habit of checking numbers and rules in an answer against the original documents. For how to check, see What is a hallucination?.

How is using RAG different from ordinary generative AI?

You get to decide for yourselves which documents the answers are based on. The technical explanation lists the benefits of RAG as: being able to use new information without retraining the AI, being able to show sources in answers, and being able to swap out the documents used or restrict which documents are visible by permission.

Point of comparison Ordinary generative AI AI using RAG
Basis of answers Knowledge up to the point the AI was trained Documents you decide on yourselves
New information Doesn't know about anything after training Updating the documents is reflected in answers
How to verify the basis Hard to tell where the information came from Can be set up to show which documents were used

Key points

The quality of RAG's answers is largely determined by the content of the documents you store. If outdated guidance or rules that are no longer in use remain, the AI will answer based on them. It is important to decide from the start who will keep the documents up to date and how.

What should I watch out for when using RAG?

First, decide in advance which materials are okay to show the AI. If internal-only materials get mixed into customer-facing answers, information you never intended to share could leak outside.

  • Separate the materials you can show from the ones you can't
  • Decide how personal information and client information will be handled before putting it in
  • When you update your materials, update the AI's source data too

Japan's national AI Operator Guidelines also state that AI users should take care not to improperly input personal or confidential information into AI ( AI Business Operator Guidelines (Version 1.2)). When standardizing how AI is used within your company, How to create internal rules for generative AI as well.

RAG is a mechanism commonly used in AI chatbots that answer inquiries. How to choose and roll out a chatbot is covered in AI Chatbot Implementation Guide, and how to use it alongside an FAQ page is covered in Should you start with an AI chatbot or an FAQ page?.

Can I consult AMALINK about AI using RAG?

Yes, Which materials the AI should base its answers on, and how to prepare those materials We accept consultations on topics like these. AMALINK LLC is a company headquartered in Uken Village on Amami Oshima.

How do I get in touch?

Please contact us via the AMALINK LINE Official Account or the contact form. " I'm not sure whether my company needs RAG, that's perfectly fine.