Fine-tuning, RLHF & Alignment·Question 24 of 61Intermediate

What's the difference between continued pretraining and SFT? When do you need domain knowledge injection?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Continued pretraining (CPT) is next-token training on a raw domain corpus (papers, contracts, codebases, clinical notes) - no chat template, no loss masking, everything gets loss. Its job is to shift the model's knowledge and language distribution: vocabulary-in-context, domain facts, style of reasoning in that field. It needs volume - typically hundreds of millions to billions of tokens - and usually full fine-tuning (a low-rank update can't absorb that much new information).

Full worked answer with diagram

Continued pretraining (CPT) is next-token training on a raw domain corpus (papers, contracts, codebases, clinical notes) - no chat template, no loss masking, everything gets loss. Its job is to shift the model's knowledge and language distribution: vocabulary-in-context, domain facts, style of reasoning in that field. It needs volume - typically hundreds of millions to billions of tokens - and usually full fine-tuning (a low-rank update can't absorb that much new information).

SFT is behaviour shaping on curated prompt/response pairs with loss masking - thousands to tens of thousands of examples teaching how to respond: format, tone, task execution, tool use. SFT reliably teaches form; it is a poor vehicle for facts - a few thousand Q&A pairs about your domain produce brittle, hallucination-prone recall.

When you need CPT: the model fails not because it formats badly, but because it genuinely doesn't know the domain - it misuses terminology, lacks the concepts, can't parse the register (dense legalese, medical shorthand, a proprietary programming language, low-resource languages). Test cheaply first: if a frontier model with good retrieved context still reasons poorly in-domain, that's evidence for CPT; if it does fine with context, RAG covers you and CPT is an expensive detour.

Key practical points: (1) CPT causes forgetting at scale - standard recipes mix a substantial replay fraction of general-domain data (frequently ~10-50%) into the domain corpus, and use a lower LR than original pretraining with warmup. (2) CPT degrades chat behaviour - you're training on raw text - so the pipeline is CPT → SFT (→ preference tuning): re-instruct the model after knowledge injection. (3) The full decision stack is: RAG for retrievable/fresh facts, CPT for internalised domain fluency, SFT for behaviour - real domain systems (legal, medical, finance) often need all three.

Worth sketching. it maps each observed symptom onto a different stage rather than one generic "train it more".

flowchart TD
    A{"What is actually failing?"} -->|"needs fresh or<br/>citable facts"| B["RAG"]
    A -->|"reasons badly in-domain<br/>even with good context"| C["Continued pretraining<br/>on raw corpus"]
    A -->|"knows it, formats badly"| D["SFT on pairs<br/>with loss masking"]
    C -->|"chat behaviour destroyed"| D
    D --> E["Preference tuning"]
    C --> F["Replay ~10-50% general data,<br/>lower LR, warmup"]

What a good answer covers

  • Continued pretraining (CPT) is next-token training on a raw domain corpus (papers, contracts, codebases,…
  • It needs volume - typically hundreds of millions to billions of tokens - and usually full fine-tuning (a…
  • SFT is behaviour shaping on curated prompt/response pairs with loss masking - thousands to tens of…
  • SFT reliably teaches form; it is a poor vehicle for facts - a few thousand Q&A pairs about your domain…
  • When you need CPT: the model fails not because it formats badly, but because it genuinely doesn't know…

Key terms: Continued pretraining (CPT) · SFT · When you need CPT · Key practical points

Interviewer follow-ups to expect

  1. Why does SFT inject knowledge so poorly compared to CPT?

  2. Design the data mixture for adapting an 8B model to clinical notes - what fractions and why?

  3. How would you check the CPT actually added knowledge rather than style?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep