Question bank
Interview Questions — Fine-Tuning (SFT, LoRA/QLoRA, Alignment, Evaluation)
62 questionsWhat the provenance labels mean
In this bank
Round: GenAI/LLM depth (required) · GenAI system design (required) · ML-systems follow-ups · applied-ML and model-platform roles Provenance: every section below is labelled Common industry pattern (topics that recur in LLM-adaptation discussions) or Generated practice. None is verified as asked by a named company. Numbers in the key points are estimates from the lessons: state your assumptions aloud. Priority: ★★★ expect it · ★★ common · ★ a differentiator for senior or research-leaning roles. These stars are our judgment, not data. How to use: answer aloud for 60 to 90 seconds, then compare with the key points. Where a detail varies by library or version (learning rates, defaults, tool names), say “practice varies; check current docs” rather than quoting a rule. The lessons are in the Fine-tuning module, and the drills are in Fine-tuning: interview drills Open the course to learn this.
A. Whether to tune, and the economics
Provenance: Common industry pattern. Teaching: When to tune, and what it costs Open the course to learn this
| # | Priority | Question | Key points | Follow-up |
|---|---|---|---|---|
| A1 | ★★★ | Prompting, RAG or fine-tuning: how do you choose?Label: Common industry pattern | Sort the failure: missing or changing knowledge points to retrieval; wrong behaviour points to a better prompt first, then tuning; cost or latency points to a smaller or cached setup, then tuning or distillation. | What evidence would change your mind? |
| A2 | ★★★ | Can fine-tuning teach the model new facts or fix hallucination?Label: Common industry pattern | Poorly. Weights cannot cite or be edited per document; one study found retrieval beat unsupervised tuning, and another found new facts were learned slowly and raised hallucination. These are particular experiments. | When is tuning on facts still defensible? |
| A3 | ★★★ | Give three good and three weak reasons to fine-tune.Label: Common industry pattern | Good: a format or routine a strong prompt still misses at volume, a small model matching a large one on a narrow task, consistent tone, a long fixed prefix, self-hosting. Weak: “know our wiki”, “stop hallucinations”, no eval set. | Which saves the most money? |
| A4 | ★★★ | What gate must a tuned model pass?Label: Common industry pattern | Beat the best prompt-plus-retrieval baseline, on the newest base model you could use, on a held-out evaluation set. A lazy first-draft prompt makes any tune look good. | What if it wins by two points? |
| A5 | ★★ | How do you build the business case?Label: Common industry pattern | Gross saving per day is calls times saving per call; net subtracts extra hosting and maintenance per day; payback is the one-off cost divided by net saving. State every assumption. | What goes in the one-off cost? |
| A6 | ★★ | A tune pays back in 14 days on paper. What do you test next?Label: Common industry pattern | Test the cheapest competent alternative. In the lesson’s example, prefix caching at 10 percent of the input price cuts the prefix to about $300 a day, below the $800 hosting bill, so the project becomes a loss (provider caching rules differ). | Where do you get the caching terms? |
| A7 | ★★ | What is the model treadmill?Label: Common industry pattern | A tune is frozen to the base it was trained on; bases improve every few months. Budget re-tuning, and re-run the baseline on the newest base before re-investing. | What triggers a re-tune? |
| A8 | ★★★ | Estimate GPU memory for full fine-tuning of a 7B model.Label: Common industry pattern | About 16 bytes per parameter in states (2 + 2 + 12 for Adam in mixed precision), so about 112 GB, before activations, logits and overhead. It does not fit one 80 GB card. | How do LoRA and QLoRA change it? |
| A9 | ★★ | Estimate training time, and say why LoRA is not 100 times faster.Label: Common industry pattern | About 6ND FLOPs divided by sustained throughput (peak times utilisation). LoRA still needs input gradients, so it is about two thirds of full compute: a memory trick far more than a compute trick. | Why not divide by the vendor headline figure? |
B. Data
Provenance: Common industry pattern. Teaching: Data engineering for fine-tuning Open the course to learn this
| # | Priority | Question | Key points | Follow-up |
|---|---|---|---|---|
| B1 | ★★★ | What makes a good SFT dataset?Label: Common industry pattern | The training set is the specification: accurate, varied, in the voice and format you want, with provenance recorded. LIMA suggests a small curated set can teach a format; it is one study and does not show new skills. | How would you test whether more data helps? |
| B2 | ★★★ | How many examples do you need?Label: Common industry pattern | No universal number. Train on 10, 25, 50 and 100 percent with the same recipe and read the learning curve; if it is flat, fix coverage or labels, not volume. | What does a still-rising curve tell you? |
| B3 | ★★★ | Why mask prompt tokens in the loss?Label: Common industry pattern | The loss should measure the behaviour you want produced; unmasked, most positions can be prompt text. Masked positions carry the ignore label (-100 in the usual libraries). | When might you train on prompts? |
| B4 | ★★★ | What is a chat template and why does it matter?Label: Common industry pattern | The contract of role markers and control tokens. Render training data with the serving template, include the end-of-turn token so the model learns to stop, and do not add special tokens twice. | How do you verify parity? |
| B5 | ★★ | In what order do you clean the data?Label: Common industry pattern | Filter, deduplicate (exact, then near), decontaminate against every eval set, remove personal data, split by group or time, then render and mask. Each step guards a different failure. | Why is the split made after deduplication? |
| B6 | ★★★ | How do you split data for a ticket-triage tune?Label: Common industry pattern | By group (thread or customer), by time if the task drifts, plus an untouched golden set reported with slices. With four rows per thread, a random row split leaves a sibling in training about 99.9 percent of the time. | What goes wrong with row-level splits? |
| B7 | ★★ | Synthetic data: benefits and risks?Label: Common industry pattern | Cheap to scale, but the student copies the teacher’s errors, diversity narrows, and provider terms may limit use. Verify with something other than the generator (run code, validate schema), blend real data, keep a real-only test set. | How do you verify without a second model? |
| B8 | ★★ | Why decontaminate, and how?Label: Common industry pattern | Overlap between training and eval items inflates scores. Remove training items that overlap eval sets; test the filter, and size the overlap window to your item length. | Why does leakage give no error message? |
| B9 | ★★ | How do you handle personal data in tuning data?Label: Common industry pattern | Strip it before training; models can reproduce rare training sequences, and removing one person from trained weights is hard, so plan to retrain from a cleaned, versioned set. Per-customer adapters where contracts require separation. | Can you unlearn one document? |
C. LoRA, QLoRA and PEFT
Provenance: Common industry pattern. Teaching: PEFT, LoRA and QLoRA in depth Open the course to learn this
| # | Priority | Question | Key points | Follow-up |
|---|---|---|---|---|
| C1 | ★★★ | Explain LoRA.Label: Common industry pattern | Freeze W and learn ΔW = B·A with rank r, so r·(d_in + d_out) numbers instead of d_in·d_out; the layer computes Wx + (α/r)·BAx. The update has rank at most r. | What can’t it do? |
| C2 | ★★★ | Why does B start at zero and A random?Label: Common industry pattern | Zero on one side starts exactly at the base; the gradient to B is non-zero, so B moves first and then A gets signal. Both zero means no gradient anywhere; both random means the model differs from the base before any step. | What does α/r scale? |
| C3 | ★★★ | Count the adapter parameters for rank 16 on a given model.Label: Common industry pattern | Sum r·(d_in + d_out) over every adapted matrix. A 2,048 by 5,632 layer at rank 16 is 122,880 numbers, about 1.07 percent of that layer. The choice of matrices moves the total far more than rank does. | How does grouped-query attention change it? |
| C4 | ★★★ | Explain QLoRA.Label: Common industry pattern | A frozen 4-bit NF4 base in blocks, double quantisation of the block constants, paged optimisers, and 16-bit adapters. Weights are dequantised to bf16 for the multiply: storage is 4-bit, compute is not. | Costs and risks? |
| C5 | ★★ | How do you choose targets, rank and learning rate for a first run?Label: Common industry pattern | Targets first: attention-only is the cheapest start, widen to all linear layers if quality lags. Rank was close to flat in the papers’ tests. Sweep the learning rate; practice varies, so check current docs and change one thing at a time. | What if raising rank does not help? |
| C6 | ★★ | LoRA or full fine-tuning?Label: Common industry pattern | LoRA buys memory and lower forgetting and pays in the size of change it can learn. One study found LoRA underperformed full tuning on code and maths, while forgetting less. Ladder: LoRA on all linear layers, higher rank, then full. | Decision rule? |
| C7 | ★★ | Why is LoRA’s compute still about two thirds of full fine-tuning?Label: Common industry pattern | Frozen layers still need the input gradients so the signal reaches the adapters; only the weight-gradient third is saved. The saving is mostly memory. | Which part of memory does it remove? |
| C8 | ★★ | Merge the adapter or serve it separately?Label: Common industry pattern | Merge for one dominant model: no extra latency. Keep adapters separate for many tenants, A/B tests and one-step rollback. After merging or quantising, re-run the evaluation; the merged model is a different artefact. | Risks of merging into a 4-bit base? |
| C9 | ★ | Other PEFT variants and methods?Label: Common industry pattern | Several LoRA variants and other adapter styles exist (for example rsLoRA changes the scale to α/√r); the lessons teach plain LoRA and QLoRA. Say what you have measured, and that variants need testing on your task. | Why did LoRA become the default? |
D. Training practice and distributed training
Provenance: Common industry pattern. Teaching: Training practice and distributed training Open the course to learn this
| # | Priority | Question | Key points | Follow-up |
|---|---|---|---|---|
| D1 | ★★★ | What does an SFT run optimise?Label: Common industry pattern | Token-level cross-entropy (negative log-likelihood) of the target, usually on response tokens only. Check masking, the end token and truncation: a setup fault gives a smooth curve for a broken model. | What does truncation hide? |
| D2 | ★★★ | Give your SFT setup and justify it.Label: Common industry pattern | Library defaults and common rates are starting points, not recommendations; adapters usually take a higher rate than full tuning. Sweep learning rate first on a short run, then epochs, then rank; practice varies, so check current docs. | How do you avoid tuning on the test set? |
| D3 | ★★★ | Gradient accumulation versus gradient checkpointing?Label: Common industry pattern | Accumulation: a smaller batch per pass, same update, costs time. Checkpointing: recompute activations instead of storing them, costs compute. Neither shrinks weights, gradients or optimiser state. | When do you use both? |
| D4 | ★★ | Compute the effective batch size.Label: Common industry pattern | Sequences per pass times accumulation steps times data-parallel GPUs; for example 4 x 8 x 8 = 256. Token-level loss should divide the whole step’s loss by its total non-padding tokens. | What goes wrong if you average the averages? |
| D5 | ★★ | DDP versus ZeRO or FSDP: per-GPU memory?Label: Common industry pattern | Replicated: 16P. ZeRO-1: 4P + 12P/N. ZeRO-2: 2P + 14P/N. ZeRO-3 and FSDP full shard: 16P/N. For 13B on 8 GPUs: 71.5, 48.75 and 26 GB for stages 1 to 3. | What does full sharding cost? |
| D6 | ★★ | Why not always shard?Label: Common industry pattern | Stage 3 costs about 1.5 times the communication of data parallelism in the ZeRO paper. If everything fits on one GPU, plain data parallelism is simpler; offload only as a last resort. | How do you measure the cost? |
| D7 | ★★★ | Loss is flat, NaN or starts too low. Diagnose.Label: Common industry pattern | Flat: all labels masked, adapter not training, rate too low. Spikes or NaN: rate too high, bad batch, no clipping. Very low start: prompt in the loss or leakage. Decode labels, overfit a tiny batch, change one thing at a time. | What is your first test? |
| D8 | ★★ | How do you pick the checkpoint?Label: Common industry pattern | By a held-out task metric (JSON-valid rate, exact match, rubric), with validation loss as a sanity check. Lower validation loss does not always mean a better model. | Why can validation loss mislead? |
E. Alignment and preference optimisation
Provenance: Common industry pattern. Teaching: Alignment and preference optimisation Open the course to learn this
| # | Priority | Question | Key points | Follow-up |
|---|---|---|---|---|
| E1 | ★★★ | Describe the RLHF pipeline.Label: Common industry pattern | SFT, then a reward model trained on rankings, then reinforcement learning (PPO in InstructGPT) against the reward minus a KL penalty to the SFT model. It holds a policy, a reference, a reward model and, in PPO, a value model. | What does the KL term do? |
| E2 | ★★★ | Explain DPO and write the loss.Label: Common industry pattern | Loss = -log σ(β[log π_θ(y_w)/π_ref(y_w) - log π_θ(y_l)/π_ref(y_l)]), over whole-answer log-probabilities. The reward model and RL loop drop out; the reference stays frozen. | What does β do? |
| E3 | ★★ | Compute a DPO loss for given log-ratios.Label: Common industry pattern | β = 0.1, ratios +1.0 and -2.0: margin 0.3, loss about 0.554. At the start the margin is 0 and the loss is ln 2 ≈ 0.693. Raise β to 0.5 and the loss falls to about 0.201. | Why can the preferred answer’s likelihood fall while the loss improves? |
| E4 | ★★ | IPO, KTO, ORPO, SimPO: what does each change?Label: Common industry pattern | IPO: a bounded squared target gap. KTO: single answers with a binary label. ORPO: an odds-ratio term added to the SFT loss, no reference. SimPO: length-normalised average log-probability plus a margin, no reference. | Which suits thumbs-up and thumbs-down data? |
| E5 | ★★ | Are the reported gains a ranking?Label: Common industry pattern | No. Each paper uses its own models, data and judges against baselines it chose; the KTO paper says no single loss wins everywhere. Pick by your data and memory, then test two candidates on your own eval with a length check. | What would a fair comparison hold fixed? |
| E6 | ★★ | Explain GRPO and verifiable rewards.Label: Common industry pattern | GRPO is an optimiser: sample a group, advantage = (reward - group mean) / group standard deviation, no critic. Verifiable rewards are a reward source (tests, checkers). Do not conflate them. | Five answers scored [1,1,1,0,1]: what are the advantages? |
| E7 | ★★ | What is reward hacking, and what are the defences?Label: Common industry pattern | The proxy score rises while true quality falls: longer, more flattering, more confident answers. Defences: KL leash or larger β, early stop on a trusted held-out measure, fresh pairs on current outputs, checkable rewards, length checks. | Is DPO immune because it has no reward model? |
| E8 | ★ | Preference tuning and safety?Label: Common industry pattern | It carries an alignment tax; run regression and safety suites before shipping, and track both harmful completions and needless refusals. RLAIF and constitutional-style pipelines are outside what the lessons verify: say so. | How would you test for over-refusal? |
F. Evaluation, deployment and special cases
Provenance: Common industry pattern. Teaching: Evaluation, deployment and special cases Open the course to learn this
| # | Priority | Question | Key points | Follow-up |
|---|---|---|---|---|
| F1 | ★★★ | Design the ship gate for a tuned model.Label: Common industry pattern | Written before training: a baseline ladder, a task metric with an interval and slices, separate regression, safety and format suites, and pass rules fixed in advance. One failed rule fails the gate. | What happens when it fails on safety? |
| F2 | ★★ | Is a two-point gain real?Label: Common industry pattern | Not without an interval. On 400 items at 0.90 the 95 percent interval is about ±0.029; a paired bootstrap on the same items is tighter. Collect more items if it includes zero. | Why score both models on the same items? |
| F3 | ★★★ | The tune improved the task but hurt general ability. What now?Label: Common industry pattern | Forgetting. Lower the rate or epochs, use a smaller adapter, mix in general data (measure the share on the regression suite), or interpolate toward the base. Compare tuned against base on the same suite. | How do you prevent it next time? |
| F4 | ★★ | Does fine-tuning affect safety?Label: Common industry pattern | Yes. One study found a tune on a few adversarial examples removed an aligned model’s safety, and benign data weakened it too. Run the safety suite on the tuned model, in both directions. | Does the base model’s safety result carry over? |
| F5 | ★★ | Task arithmetic, TIES and DARE?Label: Common industry pattern | Task arithmetic adds scaled task vectors (tuned minus base). TIES trims small changes and resolves sign conflicts. DARE drops most deltas and rescales. Merges work best from a shared base, and a merge is a new model: run the gate. | When is a merge not worth it? |
| F6 | ★★ | Merged weights or separate adapters in production?Label: Common industry pattern | Merged: no extra step, one variant per copy. Separate: one base, many small adapters, rollback by switching a pointer, A/B on one server. The vLLM docs say runtime adapter updating should not be used in production unless it is an isolated, fully trusted environment. | How do you roll out for 200 tenants? |
| F7 | ★★ | Tune the embedding model or the reranker?Label: Common industry pattern | Embedding: contrastive training on query-passage pairs with hard negatives, then re-embed the whole corpus and re-check thresholds. Reranker: no re-embedding, but it adds latency per query. Evaluate with retrieval metrics on held-out queries. | Which do you try first? |
| F8 | ★★ | How does distillation fail?Label: Common industry pattern | A student can match the average and miss the tail. Score it on the teacher’s failure slices, compare against cheaper baseline rungs, and check the teacher’s terms of use. Probability matching needs a shared vocabulary. | Which approach works across tokenisers? |
| F9 | ★★ | Managed tuning or self-hosting?Label: Common industry pattern | Managed: fast to prototype, limited control, the model usually stays on the provider. Self-hosted: control, portability and data inside your boundary, in return for running it. The gate is identical. Provider terms change: compare current docs. | When do you leave the managed service? |
G. Scenarios (diagnose aloud)
Provenance: Generated practice. Teaching: Fine-tuning: interview drills Open the course to learn this
| # | Priority | Scenario | Key points |
|---|---|---|---|
| G1 | ★★★ | “Tune a model on our wiki so it answers questions.”Label: Generated practice | Name the failure as knowledge; redirect to retrieval for sources, freshness and access control. Ask what behaviour (format, tone) tuning could add, and define the baseline and eval first. |
| G2 | ★★★ | Offline score jumped 15 points after a data refresh; production did not move.Label: Generated practice | Data-side causes and a test for each: group leakage (re-split by group), duplicates across the split, eval overlap (decontaminate), and a train-versus-serve template mismatch (decode and compare). |
| G3 | ★★ | Loss falls smoothly but the model ignores the JSON schema in production.Label: Generated practice | Decode a batch first: loss on user turns, answers truncated, missing end token, serving prompt differs. Then compare training and serving prompts and run the base on the eval set. |
| G4 | ★★ | A full fine-tune of a 13B model goes out of memory on 8 GPUs of 80 GB.Label: Generated practice | 208 GB of states replicated; ZeRO-3 or FSDP full shard gives 26 GB per GPU by the formula. Plus activations and gathered layers. Consider LoRA first. |
| G5 | ★★ | After DPO, win rate is up but answers are 40 percent longer and accuracy fell.Label: Generated practice | Suspect length exploitation. Add a length check to the win rate, raise β, use fresh pairs, balance lengths, and stop on a held-out accuracy measure. |
H. System design prompts
Provenance: Generated practice. Teaching: Fine-tuning: interview drills Open the course to learn this
| # | Priority | Prompt | Key points |
|---|---|---|---|
| H1 | ★★★ | Design a fine-tuning program for ticket-to-JSON triage at high volume.Label: Generated practice | Clarify metric and volume; baseline ladder with caching; data plan (group split, golden set, decontaminate, mask, template); LoRA first with a memory estimate; gate with intervals, slices, regression and safety; adapter rollout with shadow, canary and rollback; cost with maintenance. Walk it with the drills lesson. |
| H2 | ★★ | Design per-tenant private tuning for a multi-customer product.Label: Generated practice | One base with a small adapter per tenant, isolation and routing, personal-data handling and deletion by retraining from versioned sets, a per-tenant eval, capacity limits on loaded adapters, and cost per tenant. |
| H3 | ★ | Design continuous improvement from production feedback.Label: Generated practice | Consent and scrubbing, labelling by review or verifier, dataset versioning, an eval gate before every release, a canary, and a check that you are not training the model on its own mistakes. |
I. Project and behavioural angle
Provenance: Generated practice. See also Projects and behavioural questions.
| # | Priority | Question | Key points |
|---|---|---|---|
| I1 | ★★ | Tell me about a tuning project that did not beat the baseline.Label: Generated practice | Use a real project. Show the baseline you measured, what the eval showed, the decision you made and what you would change. Never invent figures. |
| I2 | ★ | How do you argue against a tune a stakeholder wants?Label: Generated practice | Separate knowledge from behaviour, ask for the baseline and the break-even with the cheapest alternative, propose a small LoRA pilot with a gate agreed in advance. |
Coding-round variants
- Write a function that estimates model-state memory for full fine-tuning, LoRA and QLoRA from parameters and adapter share.
- Count LoRA adapter parameters from a list of layer shapes and a rank.
- Compute the DPO loss for one pair from four log-probabilities and β.
- Compute GRPO group-relative advantages for a list of rewards, and handle the all-equal case.
- Write a paired bootstrap that returns a confidence interval for the difference between two models on the same items.
- Split a dataset by group without leakage, and check the splits share no group.
- Build labels with
-100on the prompt tokens of a chat example.
Study order (suggested)
- The ★★★ items in sections A to F: answer aloud, then compare.
- One scenario from G and the design prompt H1, timed, using the drills lesson Open the course to learn this.
- Re-derive the numbers: 16 bytes per parameter, 6ND, the LoRA count, ZeRO per-GPU memory, one DPO loss.
- The ★★ items in the sections that match your next interview, then the ★ items.
Pair with Advanced, Scenario Based and the Top 100 priority questions.