Modern LLM fine-tuning defaults to causal LM or masked LM, pick one and say why
Modern instruction tuning uses causal LM because all major deployed LLMs are decoder-only with a causal attention mask, and the fine-tuning objective must match the pretraining objective.
Imagine two different language games. In game one you read a sentence with random words covered up and guess each missing word by looking at words on both sides. In game two you read a sentence from left to right and try to predict the next word using only what came before. Both are good language exercises, but they need different rules. The first game uses a referee who lets you peek both ways, the second uses a referee who blocks you from looking ahead. The big modern chatbots like Llama and Mistral and DeepSeek were trained by playing the second game from birth. Their internal referee is built for left to right only. If you try to teach them the first game later, the referee gets confused and the lesson goes nowhere. So fine-tuning has to play the same game the model was raised on.
Detailed answer & concept explanation~9 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: name causal LM, point at the decoder-only architecture and causal mask, contrast with the MLM and encoder-only family, explain why fine-tuning must match pretraining, and dispatch the two hybrid distractors.
Real products, models, and research that use this idea.
- Llama 4 and Mistral 7B fine-tuning recipes in Hugging Face TRL use causal language modeling with response-only loss masking on chat formatted data.
- Qwen 3.5 and DeepSeek V4 distillation pipelines run plain CLM next-token prediction over chat templated sequences with prompt tokens masked from the loss.
- BERT-family encoder models like RoBERTa and DeBERTa are fine-tuned with MLM continued pretraining or with task-specific classifier heads, never with CLM, because the bidirectional attention mask is incompatible.
- T5 and its descendants use a span corruption objective that is closer in spirit to MLM than to CLM, reflecting their encoder-decoder architecture and the bidirectional encoder side.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy is the causal attention mask considered a hardcoded architectural feature rather than a data property?
QWhat happens to a decoder-only model if you continue pretraining it with an MLM objective?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating MLM and CLM as interchangeable training objectives. They are not; the attention mask in the base architecture determines which one is structurally compatible and trying to fine-tune with the wrong objective degrades the model.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.