41. How DPO differs from PPO-based RLHF
How does Direct Preference Optimization (DPO) differ from classic PPO-based RLHF?
- A.It needs no preference data of any kind
- B.It only updates the tokenizer and embeddings
- C.It needs a larger reward model than PPO does
- D.It trains on preference pairs with no separate reward model or RL loop
Show answer
Answer: D. It trains on preference pairs with no separate reward model or RL loop
DPO shows that the RLHF objective can be rewritten as a classification-style loss on chosen versus rejected responses, relative to a frozen reference model. That removes reward model training and online sampling with PPO, making it simpler and more stable. It still depends on good preference data and the strength of the reference constraint.
42. Merging a QLoRA adapter
You trained a QLoRA adapter on a 4-bit base and want one merged model for serving. Which approach keeps quality best?
- A.Merge directly into the 4-bit weights and save
- B.Average the adapter with a random adapter
- C.Retrain the adapter in 4-bit after merging
- D.Load the base in fp16, merge, then quantise if needed
Show answer
Answer: D. Load the base in fp16, merge, then quantise if needed
Adding a small update to 4-bit weights forces it to round to the nearest 4-bit level, which loses much of the update. Merging into higher-precision weights first keeps the change exactly, and you can then apply a proper quantisation method for serving.
43. Counting optimizer steps
You have 12,000 training examples, train for 3 epochs, with 2 GPUs, per-device batch size 4 and gradient accumulation 4. About how many optimizer steps will run?
- A.2,250
- B.9,000
- C.563
- D.1,125
Show answer
Answer: D. 1,125
Effective batch is 2 × 4 × 4 = 32 examples per step. One epoch is 12,000 / 32 = 375 steps, so 3 epochs is 1,125 steps. Knowing the step count matters for setting warmup and the length of the learning-rate schedule.
44. Loss on multi-turn chats
Your SFT data has multi-turn chats (system, user, assistant, user, assistant). A good default is to compute loss on:
- A.Every assistant turn, with system and user masked
- B.Only the system prompt of each chat
- C.Every token, including all the user turns
- D.Only the first user message
Show answer
Answer: A. Every assistant turn, with system and user masked
You want the model to learn how the assistant replies at each point in a conversation, so all assistant turns are useful targets. User and system text are inputs the model will receive, not things it should generate, so they are masked.
45. NaN loss in fp16 fine-tuning
Full fine-tuning in fp16 on an A100 hits NaN loss after a few hundred steps, even with a loss scaler. Which change most often fixes it on this hardware?
- A.Switch to fp8 for both weights and gradients
- B.Train in bf16, which has a much wider exponent range
- C.Raise the learning rate so updates outrun overflow
- D.Turn off gradient clipping entirely
Show answer
Answer: B. Train in bf16, which has a much wider exponent range
fp16 tops out at 65,504, so large activations or gradients can overflow to inf and then NaN. bf16 has the same exponent range as fp32, so overflow is rare, and A100 and newer GPUs run bf16 at full speed.
46. Checkpointing with frozen inputs
You turn on gradient checkpointing for a LoRA run where the embedding layer is frozen, and the adapters get no gradient. What is the usual fix in Hugging Face?
- A.Turn off the LoRA dropout setting
- B.Set the learning rate to zero for embeddings
- C.Use fp32 for the frozen base weights
- D.Call enable_input_require_grads() on the model
Show answer
Answer: D. Call enable_input_require_grads() on the model
With reentrant checkpointing, if the input to a checkpointed block does not require grad, PyTorch may skip the backward pass through it. Making the embedding output require grad, via enable_input_require_grads or prepare_model_for_kbit_training, restores gradient flow to adapters.
47. Weight decay on LoRA
What does decoupled weight decay (AdamW) do to LoRA adapter parameters during training?
- A.Pulls the adapter, and so the model, towards the base
- B.Pulls the base model weights towards zero
- C.Has no effect, because the adapters start at zero
- D.Increases the adapter rank over time
Show answer
Answer: A. Pulls the adapter, and so the model, towards the base
Weight decay shrinks the trained parameters each step. For LoRA those are A and B, so decay pulls the update BA towards zero and the model towards the frozen base. It acts as a gentle regulariser rather than shrinking the pretrained weights.
48. Chosen likelihood falls during DPO
During DPO, the margin between chosen and rejected keeps growing, but the log probability of chosen answers also falls steadily. Which change is often used to counter this?
- A.Set beta to zero to remove the reference
- B.Add an SFT (NLL) term on the chosen answers
- C.Swap chosen and rejected in half the pairs
- D.Train the reward model for more epochs
Show answer
Answer: B. Add an SFT (NLL) term on the chosen answers
DPO only cares about the gap, so it can lower both likelihoods as long as rejected falls faster, which can hurt output quality. Adding a negative log-likelihood term on chosen answers, as in RPO-style recipes, keeps chosen answers likely.
49. Off-policy preference data
You run DPO on your 8B model using public preference pairs whose answers were written by very different models. Gains are small. What usually helps most?
- A.Raise beta until the loss falls to zero
- B.Train on the rejected answers with SFT
- C.Build pairs from your own model's samples, then label them
- D.Use pairs from the other models' prompts only
Show answer
Answer: C. Build pairs from your own model's samples, then label them
DPO works best when chosen and rejected answers are likely under the policy. Answers from other models are off-policy, so the gradient pushes on text the model would rarely produce. Sampling from your own SFT model and labelling those gives more useful pairs.
50. Advantages in a GRPO group
In GRPO, four sampled answers to one maths prompt get rewards [1, 0, 0, 1]. Using (reward − mean) / std with population std, what are their advantages?
- A.[+0.5, −0.5, −0.5, +0.5]
- B.[1, 0, 0, 1]
- C.[+2, −2, −2, +2]
- D.[+1, −1, −1, +1]
Show answer
Answer: D. [+1, −1, −1, +1]
The mean is 0.5 and each reward is 0.5 away from it, so the population std is 0.5. Each advantage is ±0.5 / 0.5 = ±1. Correct answers are pushed up and wrong ones down by equal amounts. If all four rewards were equal, the advantages would be zero and that prompt teaches nothing.
51. Process and outcome reward models
How does a process reward model (PRM) differ from an outcome reward model (ORM) for multi-step reasoning?
- A.A PRM is trained only on images and audio
- B.A PRM scores each step; an ORM only the final result
- C.An ORM needs human labels for every token
- D.They are just two names for the same model
Show answer
Answer: B. A PRM scores each step; an ORM only the final result
A PRM gives feedback on intermediate steps, which helps locate where reasoning goes wrong and can guide search. An ORM judges only the end answer, which is cheaper to label but gives a sparser signal.
52. Merging two fine-tunes of one base
You have two full fine-tunes of the same base model, one for Arabic and one for SQL. What does "task arithmetic" merging do?
- A.Adds both weight deltas from the base to the base
- B.Averages the two tokenizers into a new one
- C.Runs both models and picks the longer answer
- D.Trains a third model from scratch on both datasets
Show answer
Answer: A. Adds both weight deltas from the base to the base
A task vector is fine-tuned weights minus base weights. Adding scaled task vectors to the base can combine skills without more training. Methods such as TIES and DARE reduce interference by trimming small or conflicting changes first.
53. Averaging several fine-tuned runs
You fine-tuned the same pretrained model 5 times with different hyperparameters. Averaging their weights (a "model soup") often works. Why?
- A.Averaging always works for any two models at all
- B.It removes the need for a test set
- C.It makes the merged model five times larger
- D.Runs from one start tend to share a low-loss basin
Show answer
Answer: D. Runs from one start tend to share a low-loss basin
Fine-tunes from the same pretrained weights usually end up close together in a shared low-loss region, so their average is also good and often generalises better. Averaging models trained from different random starts usually fails.
54. Fine-tuning with differential privacy
DP-SGD gives formal privacy guarantees for training on sensitive records. What does it do on each step?
- A.Encrypts the dataset before each epoch
- B.Removes rare words from the vocabulary
- C.Clips each example's gradient and adds noise
- D.Trains on a random 1% of the examples only
Show answer
Answer: C. Clips each example's gradient and adds noise
Per-example clipping bounds how much any one record can move the model, and Gaussian noise hides each record's contribution. The privacy budget (epsilon) tracks the total leakage. It usually costs some accuracy and needs larger batches.
55. Rank sweep results
Validation scores for LoRA ranks 8, 16, 32, 64 are 71.2, 74.8, 75.1 and 74.9. Serving many adapters makes size matter. Which rank is the best choice?
- A.16, since higher ranks add size for no clear gain
- B.64, since the largest rank is always safest
- C.8, since the smallest rank always generalises best
- D.32, since it has the single highest score
Show answer
Answer: A. 16, since higher ranks add size for no clear gain
The gain from 16 to 32 is 0.3 points, which is likely within run-to-run noise, while 32 doubles adapter size. When scores plateau, choose the smallest setting on the plateau. Repeating with a few seeds would confirm.
56. Splitting chat logs for evaluation
Your dataset has 40,000 chats from 2,000 customers, many repeating similar issues. You split rows randomly into train and test, and the test score is very high. What is the better split?
- A.Split by row length so long chats are in test
- B.Split by customer so no customer is in both sets
- C.Use the training set as the test set
- D.Split randomly but with a larger test set
Show answer
Answer: B. Split by customer so no customer is in both sets
With a random row split, chats from the same customer appear on both sides, so the model is tested on near-copies of what it saw. Grouping by customer (or by time) gives a test closer to real new users and a more honest score.
57. Fine-tuned small model versus API
A large API model costs ₹0.40 per request. A fine-tuned 8B model on a rented GPU costs ₹150 per hour and handles 2,000 requests an hour at full load. At full load, what is the cost per request on the GPU?
- A.₹0.75
- B.₹0.075
- C.₹0.30
- D.₹0.0075
Show answer
Answer: B. ₹0.075
₹150 / 2,000 requests = ₹0.075 per request, about 5× cheaper than the API at full load. At low traffic the GPU still costs ₹150 an hour, so per-request cost rises; the saving only holds with steady volume.
58. Offline win, online question
Your new fine-tune beats the old one on offline evals. Before full rollout to a UAE bank's customer chat, what is the best way to confirm it helps real users?
- A.Switch all traffic at once and watch for complaints
- B.Re-run the offline evals with a larger batch size
- C.Ask the model to rate its own conversations
- D.Send a small share of traffic to it and compare business metrics
Show answer
Answer: D. Send a small share of traffic to it and compare business metrics
Offline tests may miss real user behaviour. A controlled A/B or canary rollout to a small slice of traffic, measuring resolution rate, escalations and complaints, shows the true effect while limiting risk. Keep a quick rollback path.
59. Fine-tuned model scores too well
Your fine-tuned support model scores 97% on the eval set but users report many failures. You find the training data was built from the same ticket export as the eval set. What is the most likely problem?
- A.The learning rate was too low, so the model never fully converged
- B.The LoRA rank was too high, so the adapter ignored the base model
- C.Near-duplicates leaked across train and eval, inflating the score
- D.The eval set was run at temperature 0 instead of production settings
Show answer
Answer: C. Near-duplicates leaked across train and eval, inflating the score
When train and eval come from one pool, paraphrases and repeat tickets land on both sides, inflating scores. Deduplicate with fuzzy or embedding matching, split by time or by customer, and keep a fresh eval set from recent production traffic.
60. When prompting is not enough
A team has tried careful prompts and 20 examples for a niche medical coding task. Accuracy plateaued at 78%, and they have 30,000 labelled examples. What is a reasonable next step?
- A.Add all 30,000 examples to every prompt
- B.Consider fine-tuning on the labelled data and compare on a held-out set
- C.Keep rewording the instructions until accuracy improves
- D.Switch the temperature to 1 for more creative codes
Show answer
Answer: B. Consider fine-tuning on the labelled data and compare on a held-out set
When prompt changes stop helping and you have plenty of labelled data, fine-tuning can teach the mapping directly and may lower per-call cost. Pasting thousands of examples into each prompt is expensive and limited by context; a held-out set shows whether fine-tuning really wins.