Customising Foundation Models with Fine-Tuning and Continued Pre-Training
This lesson explains how to customise a foundation model with your own data when prompt engineering and RAG are not enough. Each method needs different data, costs a different amount and gives a different result.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish fine-tuning, continued pre-training and distillation by the data each needs.
- Define domain adaptation and transfer learning.
- Order the ways of customising a model by cost.
- Describe the qualities of good customisation data.
Customisation methods
Foundation models can be customised in several ways, which need different data. Fine-tuning trains the model on labelled examples of prompts and ideal completions, such as 1,000 support questions with their best answers, producing a model specialised for that task, format or style. Instruction tuning is fine-tuning on instructions and responses, which makes a model better at following instructions. Continued pre-training trains on large amounts of unlabelled text from a domain, such as medical papers, so the model learns that domain's vocabulary and knowledge.
Distillation uses the responses of a large teacher model to train a smaller student model, which is faster and cheaper for one use case. Reinforcement fine-tuning improves behaviour from feedback or reward signals rather than fixed correct answers. The following table summarises the methods.
| Method | Data needed | Result |
|---|---|---|
| Fine-tuning | Labelled prompt-completion pairs, e.g. 1,000 support questions with ideal answers | A model specialised for a task, format or style |
| Instruction tuning | Instructions with their responses | Better at following instructions |
| Continued pre-training | Large amounts of unlabelled domain data, e.g. medical papers | A model that knows the domain's vocabulary and knowledge |
| Distillation | Responses generated by a large teacher model | A smaller, faster, cheaper student model for one use case |
| Reinforcement fine-tuning | Feedback or reward signals | Improved behaviour without fixed answers |
Bedrock creates a private copy of a customised model that only you can use. Depending on the model, serving it may need Provisioned Throughput or on-demand custom model inference.
Choosing a customisation method
Related terms
Three further terms are common in discussions of customisation. Domain adaptation means making a general model work better in a specialised field, such as law or medicine, for example through continued pre-training. Transfer learning means reusing what a model learned on one task as the starting point for a new, related task, which needs far less data than training from scratch and is the idea behind fine-tuning. RLHF (reinforcement learning from human feedback) aligns a model with human preferences by training it on people's ratings of its responses. The following table summarises the terms.
| Term | Meaning |
|---|---|
| Domain adaptation | Making a model work better in a specialised field |
| Transfer learning | Reusing what a pre-trained model learned on a new, related task |
| RLHF | Aligning a model with human preferences using people's ratings of its responses |
Customisation terms
From cheapest to most expensive
The methods of customising a foundation model differ considerably in cost and effort. In ascending order of cost, they are as follows.
-
Prompt engineering and in-context learning
Examples in the prompt.
-
RAG
Retrieve your documents at question time; no training.
-
Fine-tuning
Train on a modest set of labelled examples.
-
Continued pre-training
Train on large volumes of unlabelled domain text.
-
Training from scratch
Pre-train a new model on very large data, at a cost of millions of dollars.
Custom models add training and hosting costs and need ongoing maintenance as base models improve.
The following diagram ranks the methods by relative cost.

The cost ladder
Preparing data
Customisation data must be:
- Curated, accurate and consistently labelled.
- Representative of real use, and of an appropriate size.
- Free of sensitive data you do not want the model to learn.
- Governed, with known lineage, consent and licensing.
Hold back some evaluation data to measure the improvement.
Fine-tuning data
Choosing between prompting, RAG and customisation
A software company works through four requirements for its support assistant, using the cheapest method that meets each:
| Requirement | Method | Reason |
|---|---|---|
| Answer in a friendly tone, in under 100 words | Prompt engineering | Instructions in the system prompt are enough |
| Know the details of this month's product release notes | RAG (Knowledge Bases) | Knowledge that changes often |
| Always reply in the company's strict ticket format, with its own category codes | Fine-tuning on 2,000 example tickets | A consistent behaviour that prompting does not achieve reliably |
| Cut cost for 5 million simple classification requests a month | Distillation into a smaller model | A cheaper student model imitates the large teacher model for this one task |
Continued pre-training was considered and rejected: it suits teaching a model a whole domain's vocabulary from large amounts of unlabelled text, which this company does not need. Each customised model is private to the company's account.
What data does continued pre-training use, compared with fine-tuning?
Show answer
Continued pre-training uses large amounts of unlabelled domain text, which teach the model a field's language. Fine-tuning uses labelled prompt and response pairs for a specific task.
Exam Tips
Remember for the exam
- Labelled prompt-completion examples for a task or style call for fine-tuning.
- Large volumes of unlabelled domain documents call for continued pre-training.
- A smaller, cheaper model that imitates a larger one is produced by distillation.
- The cheapest ways to improve output are prompt engineering first, then RAG.
- To align a model with human preferences, use RLHF.
- Fine-tuned Bedrock models are private to your account.