Home / Fundamentals

F5

Post-training & Alignment

Supervised fine-tuning, reward models, RLHF and DPO, reinforcement learning with verifiable rewards, LoRA and QLoRA, and when to fine-tune at all.

Guides

01

Supervised fine-tuning

How a base model becomes an assistant: chat templates, loss masking, data quality over quantity, packing, hyperparameters, forgetting, and where SFT sits in the post-training pipeline.

12 min
02

Reward models, RLHF and DPO

The Bradley–Terry reward model, the KL-regularized RLHF objective and PPO, deriving DPO from the optimal policy, its variants, and online versus offline preference learning.

15 min
03

Reinforcement learning for reasoning

Reinforcement learning with verifiable rewards, GRPO's group-relative advantages, reward hacking and length effects, test-time compute, and distilling reasoning into smaller models.

13 min
04

LoRA, QLoRA and parameter-efficient fine-tuning

The low-rank update and its initialization and scaling, parameter and memory arithmetic, which modules to adapt, QLoRA's 4-bit base, and serving many adapters.

11 min

Interview questions

30-second answer plus a full 40-minute walkthrough for each.

Q1

How does supervised fine-tuning turn a base model into an assistant? Discuss chat templates, loss masking and data.

Mid
Q2

How does LoRA work? Work through its parameter and memory savings, and explain QLoRA.

Mid
Q3

When would you fine-tune instead of using RAG or prompting, and vice versa?

Mid
Q4

How is a reward model trained, and how do you detect and prevent reward hacking?

Senior
Q5

Compare RLHF with PPO and DPO. Derive the DPO objective.

Senior
Q6

How are reasoning models trained with reinforcement learning? Explain RL with verifiable rewards and GRPO.

Senior
Q7

Design the post-training pipeline that turns a new base model into a helpful, safe assistant with strong reasoning.

Staff