RAG Explained Like You're Explaining It to Your Uncle at a Wedding

· 3 min read · Syed Omar Faruk Towaha
RAG Explained Like You're Explaining It to Your Uncle at a Wedding

It's a wedding. The biryani is excellent. Your uncle, who has heard you "do something with AI," leans over and asks: "So this ChatGPT, can it read our family business's files and answer questions?"

Here's how you explain RAG before the dessert arrives.

Uncle, the model has a great memory but no access to your cupboard

A large language model learned from a huge amount of public text, up to a certain date. It knows a lot about the world. It knows nothing about your shop's supplier contracts, your company handbook or the email your accountant sent last Tuesday. If you ask it about them, it will either say it doesn't know or, worse, make something up.

So we give it an open-book exam

Retrieval-augmented generation (RAG) means: before the model answers, we search your documents for the most relevant pieces and paste them into the question. The model answers using those pieces, like a student allowed to bring notes into the exam.

The RAG pipeline
Search first, then answer using what you found.

How the searching works

Normal search matches words. If your document says "annual leave" and you ask about "vacation days," keyword search might miss it.

RAG usually uses embeddings: each chunk of text is turned into a list of numbers that represents its meaning. Texts about similar things end up with similar numbers. So "vacation days" lands near "annual leave," even with no shared words.

# the idea, in a few lines (using any embedding model)
chunks = split_into_chunks(all_documents)          # e.g. ~500 words each
vectors = [embed(c) for c in chunks]               # store these in a vector database

question_vec = embed("How many vacation days do I get?")
best = most_similar(question_vec, vectors, top_k=4)

prompt = f"""Answer using only the context below. Cite which part you used.
If the answer isn't there, say you don't know.

Context:
{best}

Question: How many vacation days do I get?"""

Why not just retrain the model on our files?

Your uncle will ask this. The answer:

Where RAG goes wrong

Most RAG quality problems are actually search problems. Fix the retrieval and the answers usually fix themselves.

The one-sentence version for your uncle

"It's like giving a very smart assistant a librarian: the librarian finds the right pages from our files, and the assistant reads them and answers." Then go back to the biryani. You've earned it.

// related

// prefer the terminal?

Open the terminal blog and type read rag-explained-to-your-uncle.