TechSchool
Home / Interview questions / AI engineering / Fine-Tuning, Post-Training and Alignment

Fine-Tuning, Post-Training and Alignment Interview Questions

Short answers to 12 fine-tuning, post-training and alignment interview questions.

Questions and answers (12)

Answers are written in plain English and reviewed for technical accuracy. Each answer states the point first, then the reason.

1. Walk me through RLHF end to end: reward model, policy optimisation, KL penalty.

RLHF has three stages: supervised fine-tuning, reward model training, and policy optimisation with a KL penalty. First, collect human preference pairs and train a reward model to score responses. Then optimise the policy with PPO to raise the reward. The KL penalty keeps the policy close to the reference model and stops reward hacking. A typical KL coefficient is 0.01 to 0.1.

2. What is DPO and why did it displace PPO-based RLHF at many labs? When is online RL still better?

DPO trains the policy directly on preference pairs and removes the separate reward model and the RL loop. It optimises a closed-form loss that raises the log-probability gap between chosen and rejected responses. This cuts training cost and is more stable than PPO-based RLHF. Online RL is still better when you need exploration or a live reward signal.

3. Explain GRPO and why dropping the value network matters at scale.

GRPO drops the value network and estimates the advantage from a group of sampled answers to the same prompt. It normalises each reward by the group mean and standard deviation. This removes a large critic model and saves memory and FLOPs at scale. A typical group size is 8 to 64 samples per prompt.

4. Explain the LoRA decomposition mathematically. Why does it work, and how do you choose the rank r?

LoRA freezes the weight W and adds a low-rank update. The update is W' = W + (alpha/r) * B @ A, where A is r by d and B is d by r. The rank r is much smaller than the full dimension, so the update has few parameters. It works because fine-tuning changes weights in a low-rank subspace. Start with r at 8 or 16 and raise it until validation loss stops improving.

5. How does QLoRA achieve its memory reduction, and what are the quantization trade-offs?

QLoRA stores the frozen base weights in 4-bit NormalFloat and trains LoRA adapters in higher precision. It also uses double quantization and paged optimizers to cut peak memory. This lets a 65B model fine-tune on a single 48GB GPU. The trade-off is slower steps and a small quality loss from quantization.

6. Compare LoRA, prefix tuning, prompt tuning and full fine-tuning. When would you choose each?

Full fine-tuning updates all weights and gives the best quality but needs the most memory. LoRA trains small adapters and gives near full fine-tuning quality at low cost. Prefix tuning and prompt tuning train soft prompts and use the least memory. Choose prompt tuning for many tasks on one frozen model, LoRA for most fine-tuning, and full fine-tuning only with large compute.

7. What is catastrophic forgetting and how do you mitigate it during fine-tuning?

Catastrophic forgetting is the loss of general skills when fine-tuning overwrites old weights. Mitigate it with a low learning rate, a small number of epochs, and mixed training data. LoRA also limits forgetting because the base weights stay frozen. Add a KL term to the original model when you need stronger protection.

8. Prompting, RAG or fine-tuning: give me your decision framework with cost and latency attached.

Start with prompting, then add RAG for missing knowledge, then fine-tune for style or format. Prompting has the lowest cost and latency and needs no training. RAG adds retrieval latency of about 50 to 200 ms and a vector store cost. Fine-tuning adds training cost and a fixed serving cost but no per-query retrieval. Choose fine-tuning when the task needs new behaviour, not new facts.

9. Do the GPU memory maths for full fine-tuning a 7B model in bf16 with Adam. Now with LoRA.

Full fine-tuning needs about 112 GB of GPU memory for a 7B model. The weights take 14 GB in bf16. Adam states take 56 GB in fp32, and gradients take 14 GB in bf16. Activations add more memory on top. LoRA trains small adapter matrices and keeps the base weights frozen. This cuts the optimizer state to a few hundred MB.

# full fine-tune, 7B params
weights  = 7e9 * 2  # bf16 = 14 GB
grads    = 7e9 * 2  # bf16 = 14 GB
adam     = 7e9 * 8  # fp32 m and v = 56 GB
# total ~84 GB plus activations
# LoRA r=16: ~0.1 GB optimizer state

10. What is RLVR (RL with verifiable rewards) and where does it beat a learned reward model?

RLVR uses a programmatic checker as the reward function instead of a learned model. It beats a learned reward model on tasks with a clear right answer, such as math and code. The checker gives an exact signal and cannot be gamed by fluent text. A learned reward model is still needed for open-ended tasks with no automatic check.

11. Explain reward hacking in RLHF and how labs address it.

Reward hacking is when the policy finds outputs that score high but do not match human intent. The policy exploits gaps in the reward model. Labs address it with a KL penalty to a reference model and with reward model ensembles. They also use fresh preference data and periodic human review of top-scoring outputs.

12. What is distillation, and how do you build a strong small model from a large one?

Distillation trains a small student model to copy the outputs of a large teacher model. You collect teacher outputs on a large prompt set and train the student on them. Soft teacher probabilities give more signal than hard labels alone. A good tokenizer match and enough data matter more than raw teacher size.

Related lessons
Ai fine tuning Ai rlhf Ai agent intro Ai transformer