Training and Fine-Tuning Foundation Models
Training a foundation model (FM) means adjusting its weights so it captures patterns in data, and there are four elements you should recognize. Pre-training builds broad knowledge from scratch across massive unlabeled datasets, so it is slow and expensive, and you rarely do it yourself. Continuous pre-training (AWS calls it continued pre-training) keeps training an existing model on more unlabeled domain text to deepen its subject knowledge. Fine-tuning adapts an already pre-trained model to your task with labeled input-output examples. Distillation trains a smaller, cheaper model on the outputs of a larger one. For this exam you should place these on an effort-and-cost spectrum, know what kind of data each one learns from, name the fine-tuning methods such as instruction tuning and domain adaptation, prepare data responsibly (including RLHF), and remember that training changes the model's weights while RAG and prompting do not.
On this page8 sections
- What it means to train a foundation model
- Pre-training and continuous pre-training
- Fine-tuning: adapting the model to your task
- Methods of fine-tuning
- Distillation: shrinking a large model
- Preparing data to fine-tune an FM
- Reinforcement learning from human feedback (RLHF)
- Training vs RAG vs prompting and in-context learning
- Describe pre-training, continuous pre-training, fine-tuning, and distillation, and place them on the cost-and-effort spectrum.
- Identify which training elements learn from unlabeled data, labeled pairs, teacher outputs, or human rankings, and explain why.
- Compare fine-tuning methods (instruction tuning, domain adaptation, transfer learning, continuous pre-training) and know when to combine them.
- Prepare data to fine-tune an FM using curation, governance, sizing, consistent labeling, and representativeness.
- Explain reinforcement learning from human feedback (RLHF) and how it differs from supervised fine-tuning.
- Distinguish training (which updates weights) from RAG, prompt engineering, and in-context learning (which do not).
What it means to train a foundation model
Training a foundation model means adjusting its internal parameters (its weights) so it captures patterns in data. The exam asks you to recognize four key elements of training, what data each one learns from, and where each sits on an effort-and-cost spectrum. You almost never pre-train your own model; instead you take a pre-trained FM from a provider and customize it.
| Element | What it does | Data it learns from | Relative cost and effort |
|---|---|---|---|
| Pre-training | Builds broad general knowledge from scratch | Massive unlabeled text (trillions of tokens) | Highest |
| Continuous (continued) pre-training | Extends an existing model's knowledge of a domain | Large volumes of unlabeled domain text | High |
| Fine-tuning | Adapts a pre-trained model to a task, format, or style | A smaller set of labeled input-output pairs | Moderate |
| Distillation | Trains a smaller student model to mimic a larger teacher | Prompts plus the teacher model's responses | Training cost moderate; the result is cheaper to run |
Why the costs line up this way. Training cost grows with how much data the model processes and how large the model is. Pre-training starts from nothing and reads an enormous corpus. Continuous pre-training starts from a capable model, but it still processes far larger corpora than fine-tuning does (millions of documents rather than thousands of examples), so it sits above fine-tuning. Fine-tuning reuses everything the model already knows and only needs a focused labeled dataset, so it is the cheapest of the three. Match the goal to the element: broad new knowledge points to pre-training, deeper domain knowledge from raw text points to continuous pre-training, task-specific behavior points to fine-tuning, and a cheaper, faster model points to distillation.
Pre-training and continuous pre-training
Pre-training is where a foundation model learns language, reasoning, and general knowledge from scratch. It consumes enormous unlabeled datasets and large amounts of compute, so it is the most expensive and time-consuming step. Providers do this for you; on the job you consume the result rather than repeat it.
Why no labels are needed. Pre-training is self-supervised: the model repeatedly predicts the next token (or a masked token) in ordinary text, and the actual next token in that text is the correct answer. The text supplies its own labels, so nobody has to write target outputs, which is what makes training on a massive corpus practical.
Continuous pre-training, which Amazon Bedrock and the AWS documentation call continued pre-training, takes an already pre-trained model and keeps training it the same self-supervised way on additional unlabeled text from your domain. Use it when a model needs to absorb the vocabulary and concepts of a specialized field, such as medical or legal text, and you have plenty of raw documents but no labeled task examples. It deepens subject knowledge without starting over, so it costs less than pre-training but more than fine-tuning.
Used together, in order. Continuous pre-training and fine-tuning solve different problems, so they are often combined in sequence: first continue pre-training on unlabeled domain documents so the model understands the field's terms, then fine-tune on labeled pairs so it performs the task in the required way. Reversing the order wastes effort, because broad training on raw text afterwards can dilute the task behavior you just taught. If you have only labeled pairs and a moderate vocabulary gap, fine-tuning alone may be enough and costs less.
Fine-tuning: adapting the model to your task
Fine-tuning takes a pre-trained foundation model and trains it further on a smaller set of labeled examples so it performs your specific task or matches your style. Because this is supervised training (each input is paired with the output you want), it is often called supervised fine-tuning. It updates the model's weights, so it changes the model's behavior on every future request, not just a single response.
You choose fine-tuning when prompt engineering alone cannot get consistent results and the change you need is about behavior rather than fresh facts. Typical goals include matching a brand's tone, following a fixed output format, classifying support tickets into your categories, or answering in a domain's style. You supply pairs of inputs and desired outputs, and training nudges the weights toward producing those outputs. On AWS you can fine-tune supported models in Amazon Bedrock (custom models) or in Amazon SageMaker AI, for example through SageMaker JumpStart.
Fine-tuning costs more than prompting and requires good labeled data, but far less than pre-training because you start from a capable model. It also carries a maintenance cost: what the model learns is frozen at training time, so if the facts change you would have to fine-tune again. That is why facts that change often belong in retrieval, while stable behavior belongs in fine-tuning.
Methods of fine-tuning
The exam lists several fine-tuning methods. They overlap, so focus on the goal each one serves and the data it uses.
| Method | What it does | Typical data | When to use it |
|---|---|---|---|
| Instruction tuning | Teaches the model to follow directions across many kinds of tasks | Varied instructions paired with ideal responses | You want better general instruction-following across many task types |
| Domain adaptation | Specializes a general model for a field such as legal, medical, or finance | Labeled examples from the field (often after continued pre-training on its documents) | Your task uses specialized vocabulary and concepts |
| Transfer learning | Reuses features the model already learned and applies them to a new task | A relatively small task dataset | You have limited data and want to build on existing knowledge |
| Continuous pre-training | Keeps training on new unlabeled domain data | Large unlabeled domain corpus | You need deeper domain knowledge before task tuning |
Instruction tuning improves general instruction-following rather than one narrow task. Domain adaptation specializes a general model for a subject area. It builds on an existing pre-trained model, using labeled examples from the field and, where raw documents are plentiful, continued pre-training first; building a new domain model from scratch would be pre-training, the most expensive option. Transfer learning is the principle behind all fine-tuning: you reuse the general patterns learned during pre-training instead of starting over, which is why a few thousand examples can be enough where training from scratch would need vastly more.
Distillation: shrinking a large model
Model distillation trains a smaller "student" model to reproduce the behavior of a large, capable "teacher" model. You send prompts to the teacher, and its responses become the training targets for the student. The result is a compact model that keeps much of the teacher's quality while being cheaper and faster to run.
It needs little labeled data. Because the teacher generates the target outputs, you only need representative prompts, such as real production requests, not human-written answers. That makes distillation a good fit when you have plenty of unlabeled prompts but few labeled examples. Amazon Bedrock Model Distillation is the managed option: you choose a teacher and a smaller student model, supply prompts (or use your stored invocation logs), Bedrock has the teacher generate responses, and it fine-tunes the student on them.
Choose distillation when a big model performs well but costs too much or responds too slowly for production, especially at high request volumes, or when it must run on constrained hardware such as edge devices. Because inference cost scales with model size, a distilled model can cut cost per request and latency significantly. The trade-off is that the student may lose some capability, so you evaluate whether it still meets your quality bar. Remember the roles: pre-training and continuous pre-training add knowledge, fine-tuning adapts behavior, and distillation reduces size and cost while preserving as much performance as possible.
Preparing data to fine-tune an FM
A fine-tuned model is only as good as its training data, and the exam expects you to know five preparation activities.
| Activity | What it means | Common mistake |
|---|---|---|
| Curation | Select relevant, high-quality examples; remove duplicates, off-topic items, and errors | Keeping noisy scraped data because there is a lot of it |
| Governance | Confirm the right to use the data, protect privacy (remove personal details), restrict access, and record provenance | Training on data with unclear licensing or unredacted personal information |
| Size | Enough examples to teach the task; quality matters more than raw volume | Assuming the largest dataset always wins |
| Labeling | One accurate, consistent target output per example | Different labelers handling the same kind of input differently |
| Representativeness | The data mix matches the inputs and users the model will actually serve | Training mostly on one group, region, or language |
Size versus quality. A smaller set of reviewed, correct examples usually produces a better model than a much larger set full of duplicates and errors, because the model learns the mistakes too. Removing exact duplicates alone does not fix examples that are wrong or off-topic.
Consistent labeling. The model learns exactly what you show it. If the same kind of input is paired with different target outputs, whether because reviewers disagree or because each example deliberately carries several alternative answers, the training signal is mixed and the model learns no clear behavior. Write labeling guidelines, check agreement between labelers, and fix disagreements before training.
Representativeness. If the data under-represents a group, language, or scenario, the model performs worse for it, which is a form of bias. Fix the cause in the data: add genuine, reviewed examples of the missing group until its share roughly matches what the model will see in live traffic. Two tempting fixes do not work. Copying the few existing examples adds volume but not new coverage, and the model tends to overfit to those repeated items. Overshooting, so the minority group far exceeds its real share, simply creates a new skew in the other direction.
Reinforcement learning from human feedback (RLHF)
Reinforcement learning from human feedback (RLHF) aligns a model with human preferences. Human reviewers compare several of the model's own responses to the same prompt and rank them (or pick the better of two). Those rankings train a reward model that scores how much people would prefer a response, and the foundation model is then optimized to produce responses that score higher.
RLHF matters because a pre-trained model predicts likely text, which is not the same as being helpful, honest, and safe. Learning from human judgments makes the model better at following the intent of a request and at declining harmful requests. It does not add new knowledge from documents and does not make the model smaller.
RLHF versus supervised fine-tuning. These two are easy to confuse because both use human input. The difference is what the humans produce.
| Supervised fine-tuning / instruction tuning | RLHF | |
|---|---|---|
| What humans provide | Ideal responses they write for each prompt | Rankings or preferences between responses the model generated |
| Training data | Labeled prompt-response pairs | Preference comparisons, used to train a reward model |
| How the model learns | Learns to reproduce the target responses | Optimized to maximize the reward model's score |
| Typical goal | Teach a task, format, or instruction-following | Align tone, helpfulness, and safety with human preferences |
In practice the two are layered: a model is usually instruction-tuned first, then refined with RLHF. In data-preparation terms, RLHF needs a different kind of data from fine-tuning: human preference judgments rather than labeled pairs.
Training vs RAG vs prompting and in-context learning
Only training changes the model. Fine-tuning, continuous pre-training, distillation, and RLHF all update weights; Retrieval Augmented Generation (RAG), prompt engineering, and in-context learning act only at request time.
| Approach | What changes | Best for |
|---|---|---|
| Fine-tuning (and other training) | The model's weights and behavior | Consistent style, format, or task performance |
| RAG | Adds retrieved external knowledge to the prompt; no retraining | Answering from current or private documents |
| Prompt engineering | Only the wording of the request | Quick, low-cost guidance and formatting |
| In-context (few-shot) learning | Only the prompt, which includes worked examples | Showing a pattern for one request without training |
In-context learning is not fine-tuning. When you place examples in a prompt, the model uses them for that request only; its weights do not change, and the examples must be sent again every time. Fine-tuning on the same examples bakes the behavior into the model.
Combining approaches. Real applications often combine them, and the dividing line is how often something changes. Facts that change often belong in retrieval, because updating a document store is cheap while retraining is not. Stable format or behavior that prompting cannot enforce reliably belongs in a fine-tune, which you train once and reuse. Putting volatile facts into the weights instead would mean retraining whenever they change. Task 3.1 covers the cost trade-offs of these customization choices in more depth.
Tip. Expect scenarios that ask you to match a goal and the available data to a training element or fine-tuning method: lots of raw domain text with no labels points to continued pre-training, labeled pairs for a task or format point to fine-tuning, varied directions paired with ideal replies point to instruction tuning, a large model's answers training a small one point to distillation, and humans ranking the model's responses point to RLHF. Know the cost order (fine-tuning, continued pre-training, pre-training) and why, which approaches update weights (training) versus act at request time (RAG, prompting, in-context examples), and when to combine continued pre-training with fine-tuning or fine-tuning with RAG. Data-preparation questions test the five activities, especially inconsistent labels, quality over volume, and fixing under-representation with real examples that match live traffic.
- Pre-training builds broad knowledge from scratch on massive unlabeled text and is the most expensive step; you usually consume a provider's pre-trained model.
- Pre-training and continuous (continued) pre-training are self-supervised: the text supplies its own next-token labels, so they need no labeled data.
- Cost order from lowest to highest is fine-tuning, continuous pre-training, pre-training, because continuous pre-training processes far larger corpora than fine-tuning.
- Fine-tuning learns from labeled input-output pairs; continue pre-training on raw domain text first, then fine-tune, when you need both domain knowledge and task behavior.
- Distillation trains a small student on a large teacher's responses, so it needs prompts rather than labeled answers; Amazon Bedrock Model Distillation manages it.
- Good fine-tuning data is curated, governed, adequately sized, consistently labeled, and representative of live traffic; copying a minority group's few examples is not a fix.
- RLHF uses human rankings of the model's own responses to train a reward model; supervised fine-tuning uses human-written ideal responses.
- Only training updates weights; RAG, prompt engineering, and in-context (few-shot) examples act at request time and change nothing in the model.
Frequently asked questions
What is the difference between fine-tuning and RAG?
Fine-tuning updates the model's weights so its behavior changes on every request, which suits consistent style, format, or task performance. RAG (Retrieval Augmented Generation) leaves the model unchanged and retrieves relevant documents at request time to add to the prompt, which suits facts that change often or are private. Use fine-tuning to change how the model behaves and RAG to give it current knowledge without retraining; many applications combine both.
Why does pre-training not need labeled data?
Pre-training is self-supervised: the model learns by predicting the next token in ordinary text, and the actual next token is the correct answer. The text therefore provides its own labels, so nobody needs to write target outputs. Continuous (continued) pre-training works the same way on domain text, while fine-tuning needs labeled input-output pairs and RLHF needs human preference rankings.
What is the difference between pre-training and continuous pre-training?
Pre-training builds a foundation model's broad general knowledge from scratch on massive unlabeled data and is the most expensive step. Continuous pre-training, called continued pre-training in AWS documentation, keeps training an existing model on more unlabeled domain text to deepen its subject knowledge. It costs less than pre-training but more than fine-tuning, because it still processes large corpora.
How is RLHF different from supervised fine-tuning?
In supervised fine-tuning, including instruction tuning, humans write the ideal response for each prompt and the model learns to reproduce those labeled pairs. In reinforcement learning from human feedback (RLHF), humans rank several responses the model generated, a reward model learns those preferences, and the model is optimized to score higher. RLHF is mainly used to make responses more helpful and to reduce harmful outputs.
What is model distillation?
Model distillation trains a smaller student model on the responses of a larger teacher model so the student mimics the teacher at lower cost and latency. Because the teacher generates the training targets, distillation needs representative prompts rather than human-labeled answers. On AWS, Amazon Bedrock Model Distillation manages this process for supported teacher and student models.
What is fine-tuning a foundation model?
Fine-tuning a foundation model means training an already pre-trained model further on a smaller set of labeled input-output examples so it performs a specific task, follows a format, or matches a style. It updates the model's weights, so the new behavior applies to every future request, and it costs far less than pre-training because it reuses what the model already knows. Placing examples in a prompt (in-context or few-shot learning) is not fine-tuning: the weights do not change and the examples must be resent with each request.
Why does representative data matter when fine-tuning?
A fine-tuned model performs worse for groups, languages, or scenarios that are under-represented in its training data, which is a form of bias. The fix is to add genuine, reviewed examples until each group's share roughly matches live traffic. Duplicating a group's existing examples adds volume without new coverage and invites overfitting, and overshooting its real share creates a new skew.
Can continued pre-training and fine-tuning be used together?
Yes, and they are often used in sequence. Continued pre-training on unlabeled domain documents first teaches the model the field's vocabulary and concepts, and fine-tuning on labeled pairs afterwards teaches it the task and output format. Doing them in that order keeps the task behavior from being diluted by later broad training.
Source
This lesson covers the "Applications of Foundation Models" domain of the official AIF-C01 exam guide. Vendors revise their guides — check the source for the current version.
- AWS Certified AI Practitioner (AIF-C01) exam guide — Amazon Web Services
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.