Preparing Data for Continued Pre-Training and Distillation
This lesson explains the different data that continued pre-training, which teaches a model a domain's language from unlabeled text, and distillation, which teaches a small model to imitate a large one, require.
Learning outcomes
After completing this lesson, you will be able to:
- Prepare unlabeled corpora for continued pre-training.
- Prepare prompts for model distillation.
- Compare continued pre-training with distillation.
Continued pre-training data
Continued pre-training (CPT) trains a base model further on a large corpus of unlabeled domain text, such as medical literature, legal filings or internal engineering documents, so it learns vocabulary, facts and writing style before any task tuning. For current models, Amazon Bedrock's customisation methods are supervised fine-tuning, reinforcement fine-tuning and distillation (Bedrock offered continued pre-training only for the older Amazon Titan Text models). Continued pre-training of current models is done on SageMaker AI, for example with Amazon Nova customisation recipes on SageMaker HyperPod or SageMaker training jobs, or with open-weight models from SageMaker JumpStart.
CPT data needs volume and cleanliness: millions to billions of tokens, extracted cleanly from PDFs and HTML, deduplicated (near-duplicate removal matters a great deal), filtered for quality and language, stripped of PII and licensed for use. Mixing in some general text reduces catastrophic forgetting of general ability.
Distillation data
Model distillation on Bedrock transfers knowledge from a large teacher model to a smaller, faster and cheaper student model. You supply representative prompts in JSONL (or point to invocation logs from production traffic); Bedrock generates teacher responses, applies data synthesis to add variety, and fine-tunes the student. You can optionally include your own labelled prompt-response pairs. The prompt set must cover the full range of production requests, because the student only learns the teacher's behaviour on what it sees.
The following diagram shows the steps of distilling a large claims assistant model into a smaller one.

Distillation
Comparing the methods
Continued pre-training and distillation both adapt models, but they use different data for different purposes. Continued pre-training uses large amounts of unlabelled domain text, such as internal reports or scientific papers, to teach a model a domain's vocabulary and knowledge. Distillation uses prompts, and the responses of a larger teacher model, to train a smaller student model to perform a task nearly as well at lower cost and latency. The following table compares the data and purpose of the two methods.
Which data, which method?
Cutting cost with distillation
A claims assistant uses a large FM that produces excellent summaries, but cost and latency are too high at 3 million requests per month. Invocation logging has been enabled for three months.
- Select 20,000 logged prompts covering all claim types and languages, removing PII with Comprehend.
- Run a Bedrock distillation job with the large model as teacher and a smaller model in the same family as student.
- Evaluate the distilled model against the teacher on a held-out set with LLM-as-a-judge.
The distilled model reaches 96% of the teacher's judged quality at a fraction of the cost per request. Continued pre-training would not help here, because the problem is cost, not domain vocabulary.
What is a good source of prompts for model distillation?
Show answer
Invocation logs, which contain representative prompts from real use.
Exam Tips
Remember for the exam
- Teach domain vocabulary from unlabeled text: continued pre-training on SageMaker AI.
- Make a small model imitate a large one: Bedrock model distillation.
- Distillation needs representative prompts; invocation logs are a good source.
- Deduplicate and remove PII from CPT corpora.
- Mix in general data to reduce catastrophic forgetting during CPT.