Exercises — Post-training
Check what changes when a base model becomes an assistant
← Back to the lesson: Post-training
Check your understanding
Try each question before opening its answer.
- In supervised fine-tuning, why can prompt tokens be visible to the model but excluded from the loss?
Show the answer
The prompt provides the context needed to predict the response. A loss mask can exclude prompt positions from the objective while the causal attention mechanism still lets response positions read them. The attention mask and loss mask serve different purposes.- What distinguishes reward-model RLHF from DPO?
Show the answer
In the common RLHF pipeline, preference comparisons train a separate reward model, then a reinforcement-learning procedure (often PPO) optimizes the language model against that learned reward. DPO instead defines a preference loss directly over preferred and rejected responses, without a separate reward model and RL loop. Neither reward nor preference is a direct guarantee of truth.- Does LoRA normally require updating every base-model parameter? What changes instead?
Show the answer
No. In the usual parameter-efficient setup, base weights are frozen and trainable low-rank adapter parameters are added to selected modules. QLoRA additionally uses a quantized frozen base to reduce memory; it is not simply another name for ordinary full fine-tuning.- What does a chat template do in an SFT pipeline? Why should it be preserved with the tokenizer and dataset versions?
Show the answer
The template serializes messages, boundaries, and control markers into the token sequence expected by the model. A mismatched template can produce incorrect roles, message endings, or tool-call structure during training or inference. The template version is therefore part of dataset provenance and reproducibility. The loss mask remains a separate decision.
Choose the intervention
A team has two problems:
- The assistant must answer using product prices that change every day.
- Its answers must consistently follow a fixed output schema.
Which intervention would you test first for each problem, and what evidence would you collect?
Show one defensible approach
- Changing prices: test retrieval from an updatable, authoritative product store. This changes the request context without retraining. Evaluate retrieval freshness, coverage, and whether generated answers faithfully use the retrieved values.
- Fixed output schema: first test prompt instructions and structured-output constraints available in the serving stack. If reliable behaviour still requires adaptation across many tasks, evaluate SFT against a held-out set of schema-validity cases.