All guides
Practice now
D3 · Foundation model applications

Fine-tuning vs prompt engineering vs RAG

According to historical AWS exam patterns, this is the single most-tested topic on the AIF-C01: identifying which of the three customization techniques to use given the scenario presented.

The three techniques — overview

All three customize how a foundation model responds, but they act at different moments and with very different effort.

Prompt engineering

Changing how you phrase the instruction to the model. Doesn't touch the model or add external data. The lowest effort and the most immediate result.

RAG

Injecting relevant external information into the prompt in real time, retrieved from a knowledge base. Doesn't retrain the model, but requires retrieval infrastructure.

Continuing the model's training with your own dataset, adjusting its internal weights. Permanently changes the model's behavior. The highest effort and cost.

Full comparison table

CriterionPrompt engineeringRAGFine-tuning
EffortLow — immediateMedium — requires a data pipelineHigh — requires a labeled dataset and compute
CostMinimal (only inference tokens)Medium (vector storage + inference)High (training + storage of the tuned model)
What problem it solvesThe model knows the answer but needs to be guided to phrase it betterThe model doesn't have access to private or up-to-date informationThe model needs to consistently change its behavior, tone, or domain
Requires retrainingNoNoYes
Data updatesNot applicableInstant (just update the knowledge base)Requires retraining again
Typical exampleAsking the model to respond in JSON format or with examples (few-shot)A chatbot that answers using the company's internal manualA model that must always speak with the brand's tone and specific legal terminology

Mnemonic rule for the exam

If the scenario talks about "doesn't know something" → RAG. If it talks about "how it says it / what format / what tone" → prompt engineering. If it talks about "must consistently and repeatably behave differently" → fine-tuning.

Full fine-tuning vs Parameter-Efficient Fine-Tuning (PEFT)

Full fine-tuning

All of the model's parameters (weights) are updated during retraining. Requires a lot of compute capacity, a lot of time, and produces a complete copy of the model for each tuned version.

More expensive to train and store, but can achieve the deepest possible tuning.

PEFT (Parameter-Efficient Fine-Tuning) Icon-Architecture/48/Arch_Amazon-Bedrock_48

Only a small subset of additional parameters (or lightweight inserted layers) is trained, keeping the base model's original weights frozen.

Much cheaper and faster to train, requires less data, and produces small artifacts that can be combined with the base model at inference time. It's the preferred approach in most practical use cases with Bedrock.

At a conceptual level, you don't need to know the mathematical details of specific PEFT techniques for the exam — it's enough to understand that PEFT achieves results similar to full fine-tuning with a fraction of the cost and compute, by not retraining the entire model.

Related labD3 · Foundation Model Applications

Customize a model with fine-tuning in Bedrock

Adjust a foundation model with your own examples using fine-tuning in Amazon Bedrock.

Understand what fine-tuning is and how it differs from RAG
Configure a fine-tuning job with your own dataset

+1 more...

10 min6 steps

Fine-tuning methods: instruction tuning and transfer learning

"Fine-tuning" is the general term; the exam also names these two specific approaches within that category.

Instruction tuning

Tunes the model with examples formatted as instruction → desired-response pairs (e.g. "summarize this text" → correct summary), so the model learns to follow instructions more precisely and consistently in general, not just on one very narrow task.

Transfer learning

Reuses the knowledge a model already learned on one task or domain to adapt it to another related task, instead of training from scratch. Fine-tuning a foundation model is, in essence, an application of transfer learning: you start from an already-trained model and specialize it with less data and less compute.

Continuous pre-training

This is different from task-specific fine-tuning: here you keep pre-training the base model with a large volume of new, unlabeled data from a specific domain (for example, all of a company's internal technical documents, or medical literature), before applying fine-tuning for a specific task.

The goal is for the model to acquire vocabulary, style, and general domain knowledge, similar to how it was originally pre-trained but focused on that domain — a preceding, complementary step to fine-tuning, not a substitute.

Key difference from fine-tuning

Continuous pre-training uses unlabeled data and aims for the model to "learn the domain" in general. Fine-tuning uses data labeled for a specific task and aims for the model to behave in a specific way on that task.

How to prepare data for fine-tuning

The quality of fine-tuning depends directly on the quality of the training data used.

Curation

Selecting and cleaning the examples relevant to the task, removing irrelevant, duplicate, or low-quality data.

Governance

Controlling the origin, usage permissions, and traceability of the data used for training, especially if it includes sensitive or customer information.

Dataset size

Enough examples for the model to generalize the desired pattern, without being so large that training becomes unnecessarily expensive.

Labeling

Examples must have the correct answers or labels clearly defined, since the model learns directly from those labels.

Representativeness

The dataset must cover the real variety of cases the model will encounter in production, to avoid biases or blind spots.

(Reinforcement Learning from Human Feedback)

Instead of only using statically labeled examples, human comparisons and ratings of the model's responses are collected, and reinforcement learning is used to tune the model toward the responses people prefer — key to aligning the model with human preferences (helpfulness, tone, safety).

Risk: catastrophic forgetting

What it is

When you fine-tune (especially full fine-tuning) with a very specialized, narrow dataset, the model can "forget" general capabilities it had before the tuning — because its weights were strongly readjusted toward the new task, degrading its performance on tasks it wasn't continued to be trained on.

Example: a model intensively tuned only on technical support tickets can become worse at answering general knowledge questions it previously handled well.

How it's mitigated

Use PEFT techniques (which leave the original weights intact), include varied examples in the tuning dataset that preserve general capabilities, and evaluate the tuned model on both the new task and general tasks before deploying it to production.

Exam scenarios: which technique to use?

A bank wants its assistant to always respond citing the current interest rates, which change every week.

Answer:RAG

The data changes frequently and needs to always be up to date without retraining the model.

An insurer needs the model to correctly understand and use the specific legal terminology of its policies, consistently across thousands of interactions.

Answer:Fine-tuning

A deep, consistent behavior change is needed in the domain, not just occasional information.

A team wants the model's responses to always follow a Markdown table format with specific headers.

Answer:Prompt engineering

This is an output format/style adjustment — solved by giving clear instructions and examples in the prompt, without touching the model or external data.

Did you get this topic?

Test what you just learned

An e-commerce company fine-tuned a foundation model with thousands of examples of fashion product descriptions. After the tuning, they notice the model performs worse on general questions it used to handle correctly. What phenomenon does this describe?

Ready to test "Fine-tuning vs prompt engineering vs RAG"?

Put what you learned to the test with original AIF-C01 exam questions.

Start AIF-C01 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.