Contrast SFT and continued pretraining when adapting a base model to medical text
A team wants to specialize a general base model on medical content. Contrast supervised fine-tuning and continued pretraining as the adaptation method, what each objective looks like, what each one actually changes inside the model, and how a serious team would combine them.
Continued pretraining shifts what the model knows via raw next-token on unlabeled corpora; SFT shifts how the model responds via (instruction, response) pairs. Stack them: pretraining first, SFT second.
Imagine training a doctor for a new specialty. One way is to lock them in a library full of medical journals and have them read for months until the vocabulary, the diagnoses, the drug names, and the rare diseases all become second nature. They walk out knowing the subject cold but unsure how to actually talk to a patient. The other way is to hand them a thick book of example patient conversations and teach them exactly how a good doctor responds in each one. They learn bedside manner perfectly, but if they did not read the journals first, they will sometimes give confident answers about diseases they do not really understand. A serious training program stacks both: first the reading, then the practice conversations. Skip either step and the doctor either knows everything or sounds professional, but rarely both.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Domain adaptation is the question senior interviewers use to test whether a candidate understands what fine-tuning actually does inside a model versus what it just looks like from the outside. The medical adaptation framing is a classic because it has clear failure modes that surface only when you understand the difference between knowledge and behaviour.
The wrong answer that loses the interview is treating SFT and continued pretraining as interchangeable techniques on a difficulty ladder. They are not. They serve different purposes, change different parts of the model, and fail in different ways when used alone. A team that runs SFT on medical Q&A pairs and ships the result will see fluent, well-formatted responses that hallucinate confidently on facts the base model never internalised, because no amount of instruction tuning rewrites the knowledge prior. A team that runs continued pretraining without SFT will produce a model that knows medicine cold but cannot hold a conversation in the product's chat format.
The rest of this section walks the two objectives in detail, explains what each one actually changes in the model, lays out the canonical pipeline stack, addresses catastrophic forgetting as the main risk in continued pretraining, and ends with the decision rule for when to skip either step.
Two objectives, two purposes
Both methods use a next-token cross-entropy loss. The difference is the data shape and what gets masked.
Continued pretraining runs the loss on raw, unlabeled text from a domain corpus. No instruction structure, no prompt-response separation. The model sees a stream of tokens (a PubMed abstract, a clinical note, a drug monograph) and predicts each next token. The loss is computed on every token. This is identical to original pretraining at the loss level; only the data distribution differs.
The effect of continued pretraining is on the weights as a knowledge prior. Token frequencies in the domain shift the model's expectations: medical abbreviations stop looking unusual, drug names stop being out-of-distribution, factual associations between symptoms and conditions strengthen, the latent geometry of medical concepts reorganises. The model gets smarter about the domain in a generalised way that is independent of any specific task or response format.
SFT runs the loss on paired (instruction, response) examples in the chat or task format the product will serve. Crucially, the prompt tokens are masked out of the loss (typically labelled -100 in the dataset). Only the response tokens contribute to the gradient. The model sees the prompt as context and learns to produce the response.
The effect of SFT is on the conditional distribution P(response given prompt) for the formats the product uses. It teaches the model how to respond, not what to know. The knowledge prior built by pretraining is left largely intact; what changes is how that knowledge gets deployed in the product's interaction shape.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Aspect | Continued pretraining | SFT |
|---|---|---|
| Objective | Next-token on raw corpus | Next-token on instruction-response, prompt masked |
| Data shape | Unlabeled domain text | Paired (instruction, response) examples |
| Data volume | Billions of tokens | 5k to 50k high-quality pairs |
| What changes | Knowledge prior, latent geometry | Behaviour, format, instruction following |
| Failure if alone | Knows domain, cannot hold a conversation | Follows format, hallucinates on unknowns |
| Risk | Catastrophic forgetting of general capability | Overfitting to labellers, format brittleness |
Real products, models, and research that use this idea.
- Med-PaLM 2 used continued pretraining on biomedical corpora followed by SFT on clinical instruction data, the canonical medical-specialization stack.
- BioGPT extended general LLM training with continued pretraining on PubMed to build a biomedical generation model before any task-specific fine-tuning.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat is catastrophic forgetting in continued pretraining and how do you mitigate it?
Domain-only continued pretraining drifts general capability, especially reasoning and instruction following. Mitigate by mixing 10 to 30 percent general data into the corpus, using a learning rate an order of magnitude below original pretraining, and stopping after a few billion tokens rather than running long.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Treating SFT on medical Q&A pairs as sufficient for domain adaptation. SFT teaches format and style; it cannot patch underlying knowledge gaps in the base model.
60 second bullets to scan on the way to the call.
Primary sources. Browse if you want the original framing.
- Singhal et al., Med-PaLM 2: Towards Expert-Level Medical Question Answering
- Luo et al., BioGPT: Generative Pre-trained Transformer for Biomedical Text Generation and Mining
- Wu et al., BloombergGPT: A Large Language Model for Finance
- Gururangan et al., Don't Stop Pretraining: Adapt Language Models to Domains and Tasks
Same topic, related formats. Practice these next.