Continued Pretraining for a Domain
How continued pretraining teaches a model a field's language, what it costs, and the forgetting trap, explained simply for your AI interview.
In short
Continued pretraining keeps training a base model on a large amount of raw text from one field, using the same next-word goal. It teaches the field's words and patterns, but it costs a lot and can make the model forget general skills, so retrieval or fine-tuning often come first.
11 min readAdvancedOccasional · estimateFacts checked 27 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Continued pretraining means I take a base model and keep training it on a large amount of raw text from one field, like insurance claim notes. It uses the same next-word goal the model learned at the start, so it picks up the field's words and patterns. The risk is forgetting, so I mix general text back in. It is costly, so I try retrieval or fine-tuning first unless the field is far from normal text.
A base model has read a huge amount of general text, so it knows everyday English well. An insurer's claim notes use shorthand, policy codes and legal wording that barely show up in that text. Continued pretraining keeps training the base model on a large body of that raw domain text, with the same goal as before: predict the next word. Over time the model gets fluent in the field's language before anyone teaches it a task.
The main trap is forgetting. When the new text is very different from the old, the model can lose skills it had before. So I mix in general text, called replay, and I re-warm the learning rate, which is the step size for each update. In the 2024 Ibrahim study, run on two common pre-training datasets rather than a narrow field, that simple mix matched retraining from scratch, using only a fraction of the compute.
It is expensive. You need a lot of clean text, GPU time, and an evaluation to check that nothing broke. Facts also change, so a model trained on last year's policies goes stale. For fresh facts I reach for retrieval, where the model looks up current documents, and I fine-tune only for format or behaviour.
I'd choose continued pretraining when the field's language is far from web text and I have plenty of clean text, like a hospital's notes. Meditron, an open-source medical model, was built this way on curated PubMed articles and medical guidelines. It is a serious project, so I'd say so plainly and show the plan before anyone spends the compute.
What is continued pretraining, in plain words?
A base model is what pretraining produces. It has read a huge pile of general text and learned to predict the next word. Continued pretraining means training that same model further on a new pile of raw text, with the same next-word goal. Nobody labels the text with answers.
The aim is to bring a field's language and patterns into the model before any task training. Picture a junior doctor who has finished medical school and then spends a long rotation on a cardiology ward, reading the ward's own protocols and case notes. The general training stays, and the ward's vocabulary goes on top. The AI version is a hospital group that wants a model to read discharge summaries written in its own shorthand.
Key words
- Base model
- A model after pretraining, before any chat or task tuning.
- Raw domain text
- Unlabelled text from one field: claim notes, contracts, clinical notes.
- Replay
- Mixing old general text back into training so the model keeps its skills.
- Catastrophic forgetting
- When new training wipes out skills the model had before.
- Learning rate
- How big a step each update takes. Re-warming turns it up again.
Researchers call the domain version domain-adaptive pretraining. The 2020 paper Don't Stop Pretraining used that name for this idea.
How does it differ from fine-tuning?
- Continued pretraining
Raw text, no labels
Trains on unlabelled text from the field. It adds the field's words and patterns.
- Fine-tuning
Labelled examples
Trains on question and answer pairs. It teaches a format, a tone or a task.
- Both
Different jobs
Continued pretraining comes first, then fine-tuning on examples. One adds the field's words and patterns, the other adds behaviour.
How continued pretraining works
Domain text, unlabelled
claim notes and policy wordings
Keep training base model
same next-word goal as before
Stop forgetting
Replay general text
old skills mixed into each batch
Re-warm the learning rate
then decay it again on schedule
Domain-tuned base model
ready for fine-tuning on examples
- 1Raw text from the field goes in, with no labels.
- 2Training batches pass on to the replay and re-warm steps.
- 3Replay and a re-warmed learning rate help protect the old skills.
Does it actually work?
Often, yes. The Don't Stop Pretraining study tested four domains, including biomedical papers and reviews, on eight classification tasks. A second phase of pretraining on in-domain text helped, whether labelled data was plentiful or scarce.
“a second phase of pretraining in-domain (domain-adaptive pretraining) leads to performance gains, under both high- and low-resource settings”
Gururangan et al., ACL 2020
“Evaluations using four major medical benchmarks show significant performance gains over several state-of-the-art baselines before and after task-specific finetuning.”
Chen et al., 2023
Medicine is a clear case. Meditron is an open-source medical model. Its team started from Llama 2 and continued pretraining on a curated medical corpus, including selected PubMed articles, abstracts and medical guidelines. Its own tests showed gains over strong baselines, before and after task tuning.
What goes wrong, and how do you stop it?
The model can get worse at things it did well before. Researchers call this catastrophic forgetting. In a 2024 study, Ibrahim and colleagues noted that new data often leaves the model weaker on old data. Their tests used two common pre-training datasets, so a narrow field may behave differently.
“the distribution shift induced by new data typically results in degraded performance on previous data or poor adaptation to the new data.”
Ibrahim et al., 2024
Two ways to train on domain text
Domain text only
Train, no replay
no general text added
Replay mixed in
Add general text
old skills kept in each batch
Old skills may fade
the model may forget everyday English
Old skills kept
new field words still learned
- 1Training on domain text alone can push out old skills.
- 2Replayed general text keeps the old skills while the field words are learned.
The fix is simple to describe and fiddly to run. The same study found, on two common pre-training datasets, that re-warming the learning rate, decaying it again and replaying old data could match full retraining from scratch, using only a fraction of the compute. Gupta and colleagues found the cost of re-warming up front: the loss rises first, and the gain shows over a longer run.
- 1
Clean the new text
Remove duplicates, boilerplate and personal data first. Messy text teaches messy habits.
- 2
Mix in replay
Add general text so the model keeps everyday English and common reasoning.
- 3
Re-warm, then decay
Raise the learning rate a little, then bring it down again on a schedule. Expect the loss to rise at first.
- 4
Test old and new skills
Measure field tasks and general tasks after every run. A gain on one side and a loss on the other still counts as a failure.
Take a made-up mid-size insurer with 3 billion tokens of claim notes and policy wording. Its team adds 1 billion tokens of general text as replay. Each training step is 4 million tokens, so three quarters of every step comes from the company's own files. The numbers are illustrative, but the shape is what a real run plans for.
# A made-up insurer's data mix for one continued-pretraining run (numbers are illustrative).
DOMAIN_TOKENS = 3_000_000_000 # claim notes and policy wordings
GENERAL_TOKENS = 1_000_000_000 # replayed general text, to limit forgetting
BATCH_TOKENS = 4_000_000 # tokens per training step
def batch_mix(domain, general, batch):
# Share of each step taken from the company's own text.
domain_share = domain / (domain + general)
domain_per_step = round(batch * domain_share)
return domain_share, domain_per_step, batch - domain_per_step
share, domain_step, general_step = batch_mix(DOMAIN_TOKENS, GENERAL_TOKENS, BATCH_TOKENS)
steps = (DOMAIN_TOKENS + GENERAL_TOKENS) // BATCH_TOKENS
print(f"Domain share of training: {share:.0%}")
print(f"Each step: {domain_step:,} domain tokens, {general_step:,} replayed general tokens")
print(f"Total steps: {steps:,}")Output
Domain share of training: 75% Each step: 3,000,000 domain tokens, 1,000,000 replayed general tokens Total steps: 1,000
Each number is a decision the team has to defend: how much general text to keep, and whether the old-skill tests still pass after every run.
When is it worth it, and when isn't it?
- Worth it
Text far from the web
The field's words and shorthand are rare online, and you have lots of clean text to train on.
- Not worth it
Facts that change
Policies, prices and news change often. Retrieval keeps up with that, and retraining does not.
- Cost
A full project
Plan GPU time for a long run, clean data, an evaluation, and repeat runs when the data changes.
My first question is what the model must know on the day someone asks. Stable language suits training. Changing facts suit retrieval.
How would you choose for a legal team with 40,000 contracts?
A legal team has 40,000 contracts and lawyers who ask about clause wording every day. Retrieval suits this well: the model finds the right contract and answers from it, and the index updates when a contract changes. Continued pretraining would bake the old contracts into the weights, so answers go stale as clauses change. I would start with retrieval, and consider continued pretraining only if the team's wording is so unusual that the model struggles to read it at all.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: keep training a base model on raw text from one field.
- The same next-word goal, with no labels, unlike fine-tuning.
- Why it helps: the model picks up the field's words and patterns.
- The forgetting risk, and replay with a re-warmed learning rate as the fix.
- The costs: compute, clean data, evaluation and repeat runs.
- When retrieval or fine-tuning is the better first step.
Common traps
Trap"Feed it all our documents and it will know them."
BetterRaw text teaches patterns more than exact facts. Facts that change need retrieval.
Trap"A bigger base model fixes the domain gap."
BetterSize does not replace domain text. Measure the gap on your own tasks first.
Trap"Forgetting is rare, so just keep training."
BetterForgetting is well documented. Mix in replay and test old skills after every run.
Can you spot the problem?
Spot the risk
Which team plan is most likely to cause forgetting?
Quick check
An insurer's policy wording changes every quarter. What should the assistant use to answer?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Last updated on 27 November 2026
Building a model for a field with its own language?
I design and build AI products and agents, the interface and the system behind it. Book a short call and tell me what you need.