Concept · Builds on AIF-C01
Fine-tuning strategies for foundation models
Choose the lightest way to adapt a model: prompting, RAG, fine-tuning, continued pre-training or distillation.
You know from AI Practitioner
- Fine-tuning adapts a pre-trained model and reuses what it knows (transfer learning).
- Instruction tuning uses prompt and response pairs. Domain adaptation uses text from one field.
- Fine-tuning uses labeled examples. Continued pre-training uses large unlabeled text.
Better instructions or format
- Use
- Prompt engineering
- Why
- No training, fastest
Fresh or private facts
- Use
- RAG
- Why
- Edit documents, not weights
Task, tone or format
- Use
- Fine-tuning
- Why
- Labeled prompt and response pairs
Deep field vocabulary
- Use
- Continued pre-training
- Why
- Large unlabeled text
Lower cost and latency
- Use
- Distillation
- Why
- A small student copies a large teacher
| Need | Use | Why |
|---|---|---|
| Better instructions or format | Prompt engineering | No training, fastest |
| Fresh or private facts | RAG | Edit documents, not weights |
| Task, tone or format | Fine-tuning | Labeled prompt and response pairs |
| Deep field vocabulary | Continued pre-training | Large unlabeled text |
| Lower cost and latency | Distillation | A small student copies a large teacher |
1 / 2
Better instructions or format
- Use
- Prompt engineering
- Why
- No training, fastest
Fresh or private facts
- Use
- RAG
- Why
- Edit documents, not weights
Task, tone or format
- Use
- Fine-tuning
- Why
- Labeled prompt and response pairs
| Need | Use | Why |
|---|---|---|
| Better instructions or format | Prompt engineering | No training, fastest |
| Fresh or private facts | RAG | Edit documents, not weights |
| Task, tone or format | Fine-tuning | Labeled prompt and response pairs |
2 / 2
Deep field vocabulary
- Use
- Continued pre-training
- Why
- Large unlabeled text
Lower cost and latency
- Use
- Distillation
- Why
- A small student copies a large teacher
| Need | Use | Why |
|---|---|---|
| Deep field vocabulary | Continued pre-training | Large unlabeled text |
| Lower cost and latency | Distillation | A small student copies a large teacher |
Full fine-tuning
Updates every weight. Most memory and cost.
PEFT or LoRA
Trains a small adapter. The base stays frozen.
Instruction tuning
Prompt and response pairs teach it to follow requests.
Domain adaptation
Text from one field teaches its language.
Preference tuning
Better and worse answers align the model with people.
Reinforcement tuning
A reward function scores answers and the model learns from the scores.
1 / 2
Full fine-tuning
Updates every weight. Most memory and cost.
PEFT or LoRA
Trains a small adapter. The base stays frozen.
Instruction tuning
Prompt and response pairs teach it to follow requests.
Domain adaptation
Text from one field teaches its language.
2 / 2
Preference tuning
Better and worse answers align the model with people.
Reinforcement tuning
A reward function scores answers and the model learns from the scores.
What it is
Go cheapest first. Prompt engineering changes instructions and examples, with no training. RAG adds your own, current facts at question time. Fine-tuning changes the weights to teach a task, format or tone from labeled examples. Continued pre-training widens knowledge of a field from large unlabeled text. Distillation trains a small model to copy a large one, so calls are faster and cheaper.
What it is
Match the need. Style, format or a narrow task with examples: fine-tune. Facts that change or are private: RAG, since fixing a fact means editing a document, not retraining. Deep domain vocabulary with lots of raw text: continued pre-training. High traffic where latency and cost dominate: distillation. You can combine them.
What it is
Full fine-tuning updates every weight and needs the most memory. Parameter-efficient fine-tuning (PEFT), such as LoRA, trains a small set of added weights on a frozen base, so it is cheaper and keeps the base skills better. Preference tuning trains on answer pairs where people marked the better one, to align tone and safety.
Remember
- Order of effort: prompting, RAG, fine-tuning, continued pre-training.
- Instruction tuning teaches following requests. Domain adaptation teaches a field’s language.
On the exam
- “Answers must follow a fixed company format, and 5,000 labeled examples exist” points to fine-tuning.
- “Product facts change every week” points to RAG.
- “Cut the cost and latency of a large model on one high-volume task” points to distillation.
- “Adapt a large model with limited GPU memory” points to PEFT such as LoRA.
Do not mix it up with
In this task · 2.1
- Choosing a foundation model in Bedrock
- Custom, managed, pre-trained or foundation model
- Selecting ML models and algorithms
JumpStart and AutoML
- Fine-tuning strategies for foundation models
- RAG architecture patterns
- Training time, cost and performance trade-offs
- FM performance, latency and cost trade-offs
Textract
Rekognition
Comprehend
Transcribe
Translate, Polly, Lex
Personalize and health AI