Single logo
  • Courses
  • Blog
  • About
Join free on SkoolJoin free on Skool

Learning path · 12 steps

Build and Measure a RAG System
  1. 1
    What an Embedding Actually Is: Meaning as Numbers, Search by Closeness, and Where Hand-Made Numbers Break
  2. 2
    Why RAG Exists: The Problem It Solves, Compared With Pasting Everything and Fine-Tuning
  3. 3
    Real Embedding Models: an Open Model or a Provider API, Then Search, Duplicates and Recommendations
  4. 4
    Chunking Strategies for RAG: Fixed Size, Sentences or Headings, Measured on One Handbook
  5. 5
    Vector Databases Hands-On: The Same Search in Chroma and pgvector
  6. 6
    Loading and Parsing Real Documents for RAG: PDF Headers, Wrapped Lines, Tables and HTML Chrome, Scored
  7. 7
    The RAG Pipeline Explained: 7 Stages From Documents to a Cited Answer
  8. 8
    RAG Prompt Assembly and Citations: Number the Blocks, Fit a Token Budget, Check Every Claim
  9. 9
    Hybrid Search: BM25 Plus Dense Embeddings, Merged With Reciprocal Rank Fusion
  10. 10
    Reranking With a Cross-Encoder: When the Second Pass Helps, and When It Doesn't
  11. 11
    Retrieval Evals: Score the Retriever With Recall@K, MRR and nDCG Before Blaming the Model
  12. 12
    RAG Generation Metrics: Faithfulness, Groundedness and Relevance, One Claim at a Time
  1. Blog
  2. /
  3. AI Engineering
  4. /
  5. Retrieval and RAG

Learning path: Build and Measure a RAG System · Step 2 of 12

Why RAG Exists: The Problem It Solves, Compared With Pasting Everything and Fine-Tuning

A smart model has never read your company's files, and they change every month. Three ways to give it the facts: paste everything, fine-tune, or retrieve only the right pieces. Follow a refund-policy question through all three and see why RAG wins when documents change.

Chaand Sheikh

·27 November 2026Retrieval and RAG

What you will learn

  • Name the three problems behind a model that cannot answer from your documents
  • Compare pasting everything, fine-tuning and RAG when a document changes
  • Follow one question from embedding to an answer with its source
  • Know the three things RAG cannot fix: bad documents, bad chunks and no evaluation

Before you start

  • What an LLM Can and Cannot Do
  • LLM Tokens, Context Windows and Cost

You have a smart model, and it has never read your company's files. That's the whole reason RAG exists. The fix is simple to say: find the right page, and hand it over. This article is about the why. For the stages and the code, read The RAG Pipeline Explained next.

Don't retrain. Open the book.

Think of an open-book exam. A smart student meets a question they've never seen. We don't send the student back to school. We open the book at the right page, the student reads that one page, and answers from it.

The student is the model. The book is your documents. The right pages are what we retrieve.

A chatbot that cannot answer

A policy assistant for a support team. A teammate types: What is our refund window?

The answer sits in refund-policy.pdf. Your company wrote it, it's on a shared drive, and somebody edits it every month. The model never saw it. So the reply comes back empty, something like I'm not sure, I haven't seen your company's policy (an illustrative reply). The model is smart. It simply doesn't have your documents, and they keep changing.

One small problem, three problems

  1. Knowledge cut-off. A model only knows what it read before its training stopped. If the policy changed after that, it has no idea.
  2. Private data. Your contracts, tickets and handbooks were never public, so they were never in the training data.
  3. Made-up answers. With no facts at hand, a model may still sound very sure. That confident guess is a hallucination, and a wrong refund window sounds just as nice as the right one.

Three problems, one cause: the facts are not in front of the model.

Three ways to give it the facts

Way 1: paste everything

Put every document into the prompt. But a context window limits how much text fits in one prompt. Keep adding documents and you pass the limit; the file you need may not even fit. And all of it is sent, and paid for, on every single question, though most of it has nothing to do with the question.

Way 2: fine-tune the model

Train the model again on your documents. That loop is slow and costly to repeat. When it finishes, the model and the policy match, for now. Then somebody edits the file, and the model stays where it was. A teammate asks and gets the old rule. If your documents change every month, a fine-tuned model always lags behind.

Way 3: RAG, only the right pieces

Keep your documents in small pieces. When a question comes in, search them and put only the few pieces that match into the prompt. It needs a search step, but when a document changes, you update the index for that piece. Nothing is trained again.

RAG means retrieval augmented generation: retrieve first, then generate the answer.

The refund policy is edited: what each approach does next refund-policy.pdf is edited. The next question asks for the refund window. Paste everything window limit new text is there, but too much, on every question Fine-tune model weights gives the old rule until we train again RAG 3 pieces room left in the prompt swap the edited piece in the index: next answer has the new rule
An illustration of the idea, not measured data. Small prompt, fresh facts: that's why RAG exists.

One question rides the whole line

Follow What is our refund window? through a RAG system:

  1. Embed the question. That turns it into a list of numbers, a location on a map of meaning (see real embedding models).
  2. Search for the pieces sitting closest on that map.
  3. Keep the top chunks. A chunk is a small piece of a document; we keep the best few.
  4. Build the prompt. It starts with a rule like Answer using only the pages below, then the matching text from the refund policy, then the question.
  5. Answer. The model replies, and the source comes with it, so a person can open the file and check.

Two times, two lanes

This work happens at two different times.

  • Before anyone asks: documents are split into chunks, and each chunk is embedded and stored in a vector database. We do this once, and again only when a file changes.
  • On every question: embed the question, retrieve, build the prompt, answer. Retrieve searches what the first lane stored.

Notice that embedding happens in both lanes. It has to be the same model both times, so a question and a chunk can be compared fairly.

RAG brings the pages. It can't improve the book.

RAG isn't magic. Three things still go wrong:

  • Bad documents. An old policy and a new one both sit in the folder. Search finds the old one, so the answer is old.
  • Bad chunking. The cut goes right through the rule, the exception lands in the next chunk, and the answer misses it. See chunking strategies.
  • No evaluation. Answers keep coming and nobody can tell if they're right. Write a few test questions where you already know the answer. See why you cannot ship without an eval.

Better retrieval needs good documents, sensible chunks and a way to measure.

Common mistakes

  • Reaching for fine-tuning to teach facts that change. Facts belong in documents you can edit. (For the full decision, see When NOT to Fine-Tune.)
  • Assuming a big context window removes the need for retrieval. You still pay for every token, on every question.
  • Embedding questions and documents with different models.
  • Leaving old versions of a document in the index.
  • Shipping without a handful of known-answer test questions.

Quick recap

ApproachFresh facts?Prompt sizeWhen a file changes
Paste everythingYesHuge, may not fitPaste again, pay again on every question
Fine-tuneOnly until the next editSmallTrain again
RAGYesSmall, only the right piecesUpdate that piece in the index

Try it yourself

Pick one document you know well. Write three questions you can already answer from it, and mark the page for each. Those three lines are the start of a test set for any RAG system you build on that document.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in the learning path Build and Measure a RAG System · step 2 of 12

Previous
What an Embedding Actually Is: Meaning as Numbers, Search by Closeness, and Where Hand-Made Numbers Break
Next post
Real Embedding Models: an Open Model or a Provider API, Then Search, Duplicates and Recommendations

Related course on Udemy

Machine Learning Engineer: From First Model to ML Engineer

Learn machine learning in Python, then ship it: data analysis, regression, classification, tuning, deployment and MLOps.View on Udemy ↗: Machine Learning Engineer: From First Model to ML Engineer (paid course, opens in a new tab)

Related posts

What an Embedding Actually Is: Meaning as Numbers, Search by Closeness, and Where Hand-Made Numbers Break

A customer types "I cannot log in" and keyword search finds nothing, although a password-reset article exists. Turn meaning into numbers by hand, find the nearest point with math.dist, build a three-topic toy embedder that finds the right article at 1.00, and watch it score 0.00 on "I can't get into my account".

The RAG Pipeline Explained: 7 Stages From Documents to a Cited Answer

Ingest, chunk, embed, store, retrieve, rerank and generate, in one Python file. Follow one question through a 26-chunk employee handbook to an answer that cites its source.

Similarity Search: Finding the Closest Vectors with NumPy and NearestNeighbors

Ask one question of a whole collection of vectors: which items are closest to this one? Normalise, score every row with one matrix multiply, keep the top k or everything above a threshold, and check it with NearestNeighbors.

Real Embedding Models: an Open Model or a Provider API, Then Search, Duplicates and Recommendations

Swap a toy embedder for a model that learned. Two roads (all-MiniLM-L6-v2 on your machine, or OpenAI's API with your key), three sizes (384, 1,536 and 3,072 numbers), one rule, and three use cases built on the same rank function, with real scores.

On this page

  • Don't retrain. Open the book.
  • A chatbot that cannot answer
  • One small problem, three problems
  • Three ways to give it the facts
  • Way 1: paste everything
  • Way 2: fine-tune the model
  • Way 3: RAG, only the right pieces
  • One question rides the whole line
  • Two times, two lanes
  • RAG brings the pages. It can't improve the book.
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

Machine Learning Engineer: From First Model to ML Engineer

Learn machine learning in Python, then ship it: data analysis, regression, classification, tuning, deployment and MLOps.View on Udemy ↗: Machine Learning Engineer: From First Model to ML Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact usFAQs
Legal
Terms of ServicePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.