AWS Builder Center
RAG from Basics to Advanced (Part 1): Why Does RAG Even Exist?

RAG from Basics to Advanced (Part 1): Why Does RAG Even Exist?

A first-principles, interview-style breakdown of why Retrieval Augmented Generation exists comparing it against fine-tuning and long-context stuffing, cloud-agnostic before we go AWS-native.

Series: RAG from Basics to Advanced (8 articles)

  1. 1
    RAG from Basics to Advanced (Part 1): Why Does RAG Even Exist? This article
AWS DevOps Engineer | 7+ Yrs Cloud Automation | EKS, ECS, IaC | GenAI & AIOps Expert
This is Part 1 of a series that builds up Retrieval Augmented Generation (RAG) from the ground up cloud-agnostic first, then a deep dive into AWS-native implementations.

The Problem RAG Solves

Large Language Models (LLMs) like GPT and Claude are trained on a fixed snapshot of data, up to a certain cutoff date. This creates two fundamental limitations:
  1. Stale knowledge:- the model has no awareness of anything that happened after training: recent news, your company's internal documents, today's numbers.
  1. Hallucination:- when the model doesn't actually know a fact, it doesn't say "I don't know." It generates a fluent, confident-sounding answer that may simply be wrong.
Before jumping to RAG as "the answer," it's worth asking the question an interviewer would ask: why RAG, and not one of the other obvious options?

Option A: Fine-Tuning

The intuitive fix retrain the model on your own data.
Why fine-tuning isn't the default answer:
  • Cost:- fine-tuning requires meaningful compute and GPU time, especially at scale.
  • Not real-time:- every time your underlying data changes (a new document, an updated policy), you need to retrain. This doesn't work for frequently changing knowledge.
  • Weak at knowledge injection:- fine-tuning is well-suited to teaching a model behavior, style, or output format not to reliably cramming in new facts. This is a well-documented finding: fine-tuning shapes form, not facts.
  • Catastrophic forgetting:- training on narrow new data can degrade the model's broader general knowledge.
  • No traceability:- there's no way to point to where an answer came from. No source, no citation, no audit trail.

Option B: Just Stuff Everything into a Bigger Context Window

Modern models support context windows of 200K+ tokens. Why not just paste the entire knowledge base into the prompt every time?
Why large-context stuffing doesn't scale as a strategy:
  • Cost:- pricing is per-token. Sending hundreds of thousands of tokens on every single request is expensive at any real volume.
  • Latency:- larger context takes longer to process, which directly hurts response time.
  • "Lost in the middle" problem:- models are empirically worse at attending to information buried in the middle of a long context, even when it's technically "in scope." Accuracy degrades in practice, not just in theory.
  • Fundamental scalability limit:- if your knowledge base is genuinely large (thousands to millions of documents), it simply will not fit in any context window, no matter how large context windows get.

Option C: RAG

The core idea is simple: the model doesn't need to memorize everything it needs to know where to look.
When a query comes in, relevant information is retrieved from an external knowledge store (typically a vector database), and that retrieved content is injected into the prompt before generation happens.
The one-line interview answer:
RAG decouples knowledge from reasoning. Knowledge lives in an external, independently updatable store. The LLM's job is reduced to reasoning over and articulating whatever relevant knowledge it's handed.
Why RAG wins:
  • Real-time updatable:- add a new document, and it's queryable immediately. No retraining cycle.
  • Cheaper than fine-tuning:- no training runs required to reflect new information.
  • Source attribution:- because retrieval pulls from identifiable documents, you can cite exactly where an answer came from.
  • Reduced hallucination:- the model is grounded in retrieved evidence rather than relying purely on parametric memory.

Summary Table

Approach
Real-Time Updates
Cost
Traceability
Best For
Fine-tuning
Requires Retraining
High
None
Teaching Style, tone, output format
Long-context Stuffing
Technically Yes
High(Per-Token)
Weak
Small, Static Datasets
RAG
Yes
Lower
Strong
Large,Frequently Changing knowledge bases


Next in this series (Part 2): The high-level RAG architecture, Retriever + Generator and the design decisions behind why the pipeline is built the way it is.

Series: RAG from Basics to Advanced (8 articles)

  1. 1
    RAG from Basics to Advanced (Part 1): Why Does RAG Even Exist? This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article