AWS Builder Center

RAG vs Fine-Tuning, Explained With an Open-Book Exam

Student study notes for AIF-C01: foundation models, Bedrock vs JumpStart, pricing, RAG with Knowledge Bases, and an open-book exam analogy for customization.

I do AI Engineering

🎒 Why I'm Writing This

Hi everyone! I'm studying for the AWS Certified AI Practitioner (AIF-C01), and this week's big question was: when do I use RAG, and when do I fine-tune? The best way I found to remember it is an open-book exam. Here are my study notes.

🧠 GenAI Basics

  • Foundation models (FMs): large models pre-trained on huge datasets that can be adapted to many tasks.
  • Tokens: the chunks of text a model reads and writes. Pricing and context limits are counted in tokens.
  • Embeddings: numbers that capture the meaning of text, so similar ideas sit close together. They power semantic search.
  • Temperature: controls randomness. Low gives focused, predictable answers. High gives more creative ones.

🏗️ Bedrock vs SageMaker JumpStart

  • Amazon Bedrock: serverless, one API to many foundation models. Great for building GenAI apps fast without managing infrastructure.
  • SageMaker JumpStart: a hub of pre-trained models you deploy and customize on SageMaker endpoints. You get more control, and also more to manage.
  • Exam shortcut: managed and simple points to Bedrock. Deep control over the model and hosting points to JumpStart.

💰 Bedrock Pricing: On-Demand vs Provisioned Throughput

  • On-Demand: pay per token with no commitment. Good for experiments and unpredictable traffic.
  • Provisioned Throughput: you commit to model units for a period (for example 1 or 6 months). It gives steady performance and is required for some custom models.
  • Think of it as pay-as-you-go versus reserving capacity.

📚 The Open-Book Exam Analogy

  • RAG is like bringing your notes into an open-book exam. The model looks up fresh facts at answer time.
  • Fine-tuning is like memorizing a new subject. You train on labeled examples so the model learns a style or task.
  • Continued pre-training is like reading the whole library. You feed lots of unlabeled domain text so the model learns the field's language.

🔎 RAG With Knowledge Bases for Amazon Bedrock

Knowledge Bases for Amazon Bedrock handle the RAG pipeline for you:
  • Connect a data source such as documents in Amazon S3.
  • The service chunks the documents and creates embeddings.
  • Embeddings are stored in a vector store such as OpenSearch Serverless.
  • At question time, it retrieves the most relevant chunks and adds them to the prompt.
  • Bonus: answers can include citations, and no model retraining is needed.

📊 Comparing the Approaches

Approach
Data needed
Cost
When to use
Prompt engineering
None, just good instructions
Lowest
Quick wins and first attempt at any task
RAG
Your documents, indexed in a vector store
Low to medium
Up-to-date or private knowledge, with citations
Fine-tuning
Hundreds or thousands of labeled examples
Medium to high
Specific style, format or task behavior
Continued pre-training
Large amounts of unlabeled domain text
Highest
Deep domain vocabulary and knowledge

✅ Quick Exam Tips

  • Start simple: prompt engineering, then RAG, then fine-tuning.
  • Facts change often? Choose RAG, not retraining.
  • Need a consistent tone or format? Think fine-tuning.
  • Unlabeled data plus a new domain? Think continued pre-training.
  • Lower temperature when you want consistent answers.

🧩 How I'm Practicing

  • I write a one-line summary for each approach and test myself without looking at my notes.
  • I turn every practice question into a scenario: what data do I have, how often does it change, and what is my budget?
  • I review wrong answers by asking which keyword in the question should have pointed me to the right service.
  • I explain each concept out loud as if teaching a friend, because that quickly shows what I don't understand yet.

💬 Let's discuss

  • Which approach did you find hardest to tell apart on practice questions, and why?
  • Do you have a favorite analogy or memory trick for remembering when to use RAG versus fine-tuning?
Thanks for reading, and good luck to everyone preparing for AIF-C01! 🚀
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