Basics

What is RAG — letting an AI peek at your cheat sheet

Illustration: a model peeking at a cheat sheet

Here's a strange thing. The model has never seen your work manual. It wasn't around when the AI was trained. Yet it goes and answers from it — accurately, citing the right clause.

How? Did it secretly study up?

No. It was simply let to peek at a cheat sheet right before answering. That trick is called RAG.

Where an AI gets its answers in the first place

First, the plain chat. No cheat sheet.

A model answers from memory — from what it soaked up during training. It's like a person who's read a lot and then speaks from recall.

And there are two holes here.

  • Your private documents aren't in that memory. The AI can't know about your colleague's email from yesterday.
  • The memory is "frozen" at the day training ended. Anything later is a blank.

So when you ask about your own papers, an ordinary model starts to guess. And guessing, it happily invents plausible nonsense.

How the cheat sheet works

RAG plugs both holes. And it does it almost laughably simply.

The idea, in three steps:

  • Find. From your pile of documents, the system grabs a couple of snippets that are actually about your question.
  • Hand over. It pastes those snippets straight into the prompt — like a note saying "here, keep this handy."
  • Answer. The model reads them along with the question and answers from them, not from memory.

That's the whole trick. The AI itself isn't retrained one bit. It just has the right page on its desk before it answers.

The English name honestly spells out the order: retrieval-augmented generation — generation boosted by retrieval. Find first, then answer.

Why this is worth knowing

RAG sounds technical, but it's under the hood of things you already use.

  • A bot for your documents. Drop in a folder of contracts and ask about them in plain language.
  • Support that answers from the company's knowledge base. It doesn't invent — it pulls the answer from the real manuals.
  • "Ask this PDF." Hand over a textbook and ask questions straight from it.

And the big bonus: since the model answers from text in front of it, it has less reason to lie. Good systems will even show which snippet the answer came from — so you can check.

Once the cheat-sheet image clicks, it stops being a mystery how an AI "knows" your fresh papers. It doesn't know them. It just took a peek.

Learn vibe coding — don’t just read about it

Short story-lessons, an agent simulator and daily practice — in our mobile app. Free.

Open the app
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →