Acadbyte
Start free

Retrieval-Augmented Generation (RAG)

A model has never seen your company's refund policy. So how does it answer questions about it correctly — and cite the paragraph?

Intermediate7 min2 concepts · 1 question · 1 card

Don't put the knowledge in the model

A model's weights are frozen at training time. It has never seen your Confluence, your contracts, or last Tuesday's incident report. Ask it about your refund policy and it will do the most plausible thing available: write a refund policy that sounds like the ones it has seen. Fluent, confident, well-structured, and not yours.

Fine-tuning is one answer, and it's usually the wrong one. It's slow and expensive, it has to be redone every time a fact changes, and it teaches style far more reliably than it teaches facts. You cannot retrain a model every time someone edits a policy page.

RAG takes a different route entirely. Don't put the knowledge in the model. Put it in the prompt.

The loop

  1. Retrieve. Take the user's question, search your own documents, pull back the handful of passages most likely to contain the answer.
  2. Augment. Paste those passages into the prompt: "Using only the context below, answer the question."
  3. Generate. The model answers — from text sitting directly in front of it.

The model still doesn't know your refund policy. It doesn't need to. It can read.

And because the answer came from a specific retrieved passage, you can show the user that passage. Citation isn't a bolt-on feature here; it falls out of the architecture for free.

The rest of this topic comes with a free account

Reading stays open to everyone. The questions, the cards and the review schedule need somewhere to remember you — that’s all an account is for here.

Or start with the free track, which needs no account at all.

Next in GenAI in Practice

Embeddings for Search

How does a search box find 'get my money back' inside a document that only ever says 'reimbursement'?

Read the preview