Fine-tuning: interview drills

  • Production
  • 45 min
  • Lesson 7 of 7 in Fine-tuning
  • Last verified

Open slides(34 slides)

Before you start

You will be able to

  • Give a 90-second answer to whether a team should fine-tune, covering the failure kind, the baseline a tune must beat, the break-even against a cheaper alternative, and the upkeep.
  • Work the memory derivations: model states of full fine-tuning at 16 bytes per parameter, the trainable parameters of a stated LoRA setup, QLoRA states, and ZeRO per-GPU states, and say what each estimate leaves out.
  • Work a training-time estimate from 6ND with LoRA at about two thirds, and the DPO loss for given log-ratios, and say what a larger beta does.
  • Structure a 40-minute answer to design a fine-tuning program, from clarifying questions and a baseline through data, method, evaluation gate, rollout and upkeep.
  • Diagnose a described symptom, such as a clean loss with broken output, a fall in general ability or a score that jumped after a data refresh, by naming the likely causes in order and the first thing to check.

The review panel meets in the small room at the end of the day. Aarav reads a case aloud, evenly, and waits to be told whether it was right.

Kavya has the training data in tidy folders. Ananya says only that the panel would like to hear your case.

They ask you to defend whether to retrain Aarav at all. Where do you begin?

Concept

This lesson is the rehearsal for the panel’s question in the story, for fine-tuning interviews, which tend to combine a decision question, a sizing exercise and a design prompt. This lesson turns the module into practice. Everything below can be built from lessons 1 to 6, and it should be said aloud, in an order a listener can follow, against a clock. Try each prompt before you open its key. A drill you only read teaches little. The reading estimate covers the opener, the derivations, the drills and the quiz. The timed design drill (40 minutes) and the mock plan (45 minutes) are practice sessions you run separately, outside the 45.

All questions are Common industry pattern or Generated practice, and none is verified as asked by a named company. A sample answer is one good answer, not the only one. Library names and defaults are those of the docs read on 2026-10-21; if your interview uses a newer version, say which version you last read. Every derivation was recomputed with a script. All input figures are invented for the exercise and marked as illustrative.

Why It Matters

Knowing that full fine-tuning needs 16 bytes per parameter is not the same as using it to say, in thirty seconds, which GPU you need. Interviewers for tuning roles tend to probe a few things: whether you ask what failed before proposing a method, whether you can size a run with stated assumptions, whether you put a baseline and a gate in front of any tune, and whether you will say when not to tune at all.

Mental Model

The board’s question is the whole exercise. A strong answer goes in a fixed order, so you stay calm and the listener can follow: name the failure, name the cheapest thing that could fix it, price the tune against that, then say how you will know it worked and what it costs to keep. The order matters more than any single formula.

Diagram: A strong answer follows a fixed order: name the failure, name the cheapest thing that could fix it, price the tune against that, say how...

1 Name the failure

2 Name the cheapest fix

3 Price the tune against it

4 Say how you will know it worked

5 Say how you will maintain it

Diagram summary: A strong answer follows a fixed order: name the failure, name the cheapest thing that could fix it, price the tune against that, say how you will know it worked, and say how you will maintain it.

The 90-second opener

Rehearse this until it fits in about ninety seconds:

“First I sort the failure. Missing or changing knowledge goes to retrieval. Wrong behaviour goes to a better prompt and examples, and to tuning only if those fall short at volume. Cost or latency goes to caching or a smaller model first. A tune has to beat the best prompt-plus-retrieval baseline, on the newest base model, on a held-out set. Then I write the break-even: one-off cost over the daily saving after hosting and maintenance, and I test it against the cheapest alternative, such as prefix caching, because that can erase the saving. If it holds, I start with a small LoRA run, size the memory and time from 16 bytes per parameter and 6ND with assumptions stated, and gate the result on the task metric with an interval and slices, plus regression, safety and format suites compared with the base. I ship it with a canary and a rollback, and I plan to re-run the decision when the base model changes.”

Then add the sentence that shows judgement: “If the failure is stale facts, I would not tune at all.”

Whiteboard derivations

Try each before reading the key. Every input is illustrative. Sizes are decimal GB, and every memory figure is a floor that leaves out activations, logits and framework overhead.

  • B1. Full fine-tuning states. An 8B-parameter model and a 34B-parameter model, Adam, mixed precision. How many GB of model states?
  • B2. LoRA parameters. A made-up decoder: hidden size 3,072, 28 layers, gated MLP with intermediate size 8,192, full multi-head attention (query, key, value and output projections each 3,072×3,0723{,}072 \times 3{,}072). Rank 16 on all linear layers. How many trainable parameters, as a share of the base linear parameters, and how many GB of training states for the adapter at 16 bytes per parameter?
  • B3. QLoRA states. The 34B model with a 4-bit base and an adapter of 0.5 percent of the base. Include the quantisation constants after double quantisation. Does it fit a 24 GB card?
  • B4. Time. An 8B model, 50 million tokens per epoch, 2 epochs, one GPU sustaining 300 TFLOP/s. Full fine-tuning time, and LoRA time.
  • B5. ZeRO. The 34B model on 16 GPUs of 80 GB each. States per GPU under plain data parallelism and ZeRO stages 1, 2 and 3.
  • B6. DPO loss. Beta 0.25. The preferred answer’s log-ratio is +0.6 and the rejected answer’s is -1.4. Compute the loss. Then raise beta to 1.0 with the same log-ratios.

Key.

  • B1: 16×8=12816 \times 8 = 128 GB for the 8B model; 16×34=54416 \times 34 = 544 GB for the 34B model (2 bytes for 16-bit parameters, 2 for gradients, 12 for the Adam terms). Neither figure fits one 80 GB card, and activations come on top.
  • B2: Attention per layer: 4×16×(3,072+3,072)=393,2164 \times 16 \times (3{,}072 + 3{,}072) = 393{,}216. MLP per layer: 3×16×(3,072+8,192)=540,6723 \times 16 \times (3{,}072 + 8{,}192) = 540{,}672. Per layer 933,888; over 28 layers 26,148,864 trainable parameters. The base linear parameters are 28×(4×3,0722+3×3,072×8,192)=3,170,893,82428 \times (4 \times 3{,}072^{2} + 3 \times 3{,}072 \times 8{,}192) = 3{,}170{,}893{,}824, so the adapter is about 0.82 percent. The adapter’s training states at 16 bytes per parameter are about 0.42 GB. What it leaves out: embeddings and norm layers were ignored, the frozen base still has to be stored, and activations are extra.
  • B3: The 4-bit base costs 0.5×34=170.5 \times 34 = 17 GB. The adapter is 0.5 percent of 34B, or 0.17B parameters, at 16 bytes: 2.72 GB. Double quantisation leaves 0.127 bits per parameter of constants: 34×109×0.127÷8≈0.54 GB34 \times 10^{9} \times 0.127 \div 8 \approx 0.54\ \text{GB}. The floor is about 20.3 GB. A 24 GB card is left with under 4 GB for everything else, and lesson 1’s example of a single logits tensor, 8.4 GB for 16,384 tokens at a 128,000 vocabulary, shows how fast that goes. So: not at a normal batch size; a 48 GB card is the more realistic home.
  • B4: FLOPs =6×8×109×(2×5×107)=4.8×1018= 6 \times 8 \times 10^{9} \times (2 \times 5 \times 10^{7}) = 4.8 \times 10^{18}. Time =4.8×1018÷(300×1012)=16,000 s= 4.8 \times 10^{18} \div (300 \times 10^{12}) = 16{,}000\ \text{s}, about 4.4 hours. LoRA is about two thirds of that, roughly 3.0 hours. The 300 TFLOP/s is an assumption, and 128 GB of states means this run needs more than one GPU in practice, so state that the figure ignores the lost efficiency.
  • B5: Plain data parallelism: 544 GB per GPU, which cannot fit. ZeRO-1: 4×34+12×34÷16=136+25.5=161.5 GB4 \times 34 + 12 \times 34 \div 16 = 136 + 25.5 = 161.5\ \text{GB}. ZeRO-2: 2×34+14×34÷16=68+29.75=97.75 GB2 \times 34 + 14 \times 34 \div 16 = 68 + 29.75 = 97.75\ \text{GB}. ZeRO-3: 544÷16=34 GB544 \div 16 = 34\ \text{GB}. Only stage 3 fits an 80 GB card, and it leaves about 46 GB for activations and gathered layers. It pays 1.5 times the communication of data parallelism (3 units against 2 in the ZeRO paper).
  • B6: Margin =0.25×(0.6−(−1.4))=0.5= 0.25 \times (0.6 - (-1.4)) = 0.5. σ(0.5)≈0.622\sigma(0.5) \approx 0.622, so loss =−ln⁡(0.622)≈0.474= -\ln(0.622) \approx 0.474. With beta 1.0 the margin is 2.0, σ(2.0)≈0.881\sigma(2.0) \approx 0.881 and the loss is about 0.127. The same movement is treated as nearly solved, so training stops pushing sooner and the model stays closer to the reference. The loss depends only on the difference of the two log-ratios, so log-ratios of -0.5 and -2.5 give the same 0.474 even though the preferred answer became less likely.

Design drill: a fine-tuning program (40 minutes)

Prompt. A support platform handles 3 million tickets a day with a large API model and a 1,200-token prompt that extracts a JSON triage record (category, priority, product, sentiment, suggested action). Cost is high and the tone is inconsistent. Propose whether and how to fine-tune. You have 60,000 labelled historical tickets with noisy labels, strict personal-data rules, and one platform team. All figures are invented for the exercise.

A framework to say aloud.

  1. Clarify. Success metrics (field accuracy, schema-valid rate, latency, cost per call), constraints (personal data, residency), what regression is acceptable, the timeline, and who will maintain it.
  2. Baseline first. The best prompt with examples, with prompt caching on. The prefix alone is 1,200×3,000,000=3.61{,}200 \times 3{,}000{,}000 = 3.6 billion input tokens a day. At an assumed $1 per million that is $3,600 a day, but if cached input is billed at 10 percent (an assumption; check your provider), it is about $360. A tune that only removes the prefix can save at most that, so the case for tuning must rest on the price gap between the large model and a small hosted one, as well as on tone.
  3. Data. Sample the labels with a second reviewer to measure noise. Strip personal data. Deduplicate, then decontaminate against the evaluation sets. Split by group (the ticket thread or customer) and by time if the product changes. Keep a hand-verified golden set with slices (language, rare categories, long tickets). Render with the serving template, include the end token, mask to the assistant tokens, and decode a batch.
  4. Method. LoRA SFT on a small open model first, and full fine-tuning only if a held-out gap justifies it. Preference methods only if you have chosen and rejected pairs on near-policy outputs.
  5. Training plan. Estimate memory and time with stated assumptions (B1 to B5), run a learning curve to see whether more data helps, and overfit a tiny batch as a pipeline check.
  6. Gate. Written before training: a baseline ladder, field accuracy with an interval and slices, schema-valid rate, a regression suite and a safety suite compared with the base, and pass rules.
  7. Serving and rollout. Adapter or merged weights, shadow traffic, a canary, and rollback by pointing to the previous adapter.
  8. Upkeep. Re-tune triggers (a new base model, a schema change, drift), a re-run of the baseline on the new base, consent and personal-data handling for logs, and a cost model with its assumptions.
  9. Alternatives and fallback. Prefix caching alone, a smaller classifier for some fields, or a router that sends low-confidence tickets to the large model. Say what each costs.
Diagram: A router sends confident tickets to a tuned small model and the rest to a large model; both pass a validator.

high confidence

low confidence or novel

passes

Ticket

Router:
confidence gate

Tuned small model

Large API model

Validator:
schema and rules

Triage record

Logs, personal data removed

Human review sample

Next dataset version

Train and evaluation gate

Canary, rollback pointer

Diagram summary: A router sends confident tickets to a tuned small model and the rest to a large model; both pass a validator. Logs with personal data removed feed a human review sample and the next dataset, which must pass the evaluation gate and a canary before replacing the small model.

Markers of a strong answer. A baseline with caching before any tuning; label noise handled; a group split and a golden set with slices; a stated memory and time estimate with its omissions; a gate with a regression and a safety suite; a canary and rollback; upkeep when the base changes; and a fallback route. Expect a change of constraint (“the data may not leave our network”, “volume doubles”). Re-cost aloud and name the risk you accept.

Variant to try cold. The same program for a legal-document summariser with very long inputs and strict citation requirements. The knowledge and citation need points to retrieval first; a tune would be only for style and structure.

Debugging drills

Say the likely causes aloud, in order, before reading the right-hand column.

SymptomCauses to walk through, and the first check
Training loss is clean but production JSON is brokenTemplate mismatch between training and serving; end token missing; long examples truncated before the answer. First: decode one batch, then compare the training and serving prompts character by character
Task score up, general benchmark downForgetting from a high learning rate, many epochs, narrow data or full tuning. First: run the regression suite on base and tuned and read the difference
The model never stops generatingEnd token absent from the targets or mismatched with the template. First: look at the labels at the end of a decoded sequence
After DPO the answers are longer and less accurateLength rewarded by the judge or the preference data; beta too small; pairs not from near the policy. First: a length check on the win rate and the absolute likelihoods of the chosen answers
The score jumped 15 points after a data refreshRelated rows split across train and test; duplicates; evaluation items inside the training data. First: check overlap between train and evaluation, and re-split by group
A QLoRA run runs out of memory at step 200A batch of long sequences spiking activations and logits; no checkpointing. First: the length of the longest batch, then cap length, enable gradient checkpointing, or lower the per-pass batch and accumulate
The adapter passed the gate but the merged model is worseA merge is a new model; merging into a quantised base re-quantises it. First: re-run the whole gate on the merged artefact
Diagram: Name the symptom first and each points to a likely cause and a first check: decode a batch for broken output, run the regression suite for...

Clean loss, broken production output

Task up, general down

Score jumped after a data refresh

Longer, less accurate after DPO

Passed the gate, merged model worse

Symptom after a tune

Which one?

Template mismatch, missing end token, truncation:
decode one batch

Forgetting: run the regression suite on base and tuned

Leakage: check train and eval overlap, re-split by group

Length rewarded: length-check the win rate, raise beta

A merge is a new model: re-run the gate on the merged artefact

Diagram summary: Name the symptom first and each points to a likely cause and a first check: decode a batch for broken output, run the regression suite for forgetting, check overlap after a suspicious score jump, check length for post-DPO verbosity, and re-run the gate on a merged model.

Rapid-fire

Answer each in about twenty seconds.

  1. How many bytes per parameter for full fine-tuning with Adam in mixed precision?
  2. Why does LoRA start with B at zero and A random?
  3. Name QLoRA’s three memory tricks. Which part stays in 16-bit?
  4. Does gradient checkpointing shrink model states?
  5. Per-GPU states under ZeRO-3, and what does it cost?
  6. What does the KL penalty protect against?
  7. Which models does DPO keep in memory?
  8. How is a GRPO advantage computed?
  9. Why split by group?
  10. Why is LoRA about two thirds of full compute?
  11. Merge or swap for 200 tenants?
  12. What does an embedding tune force downstream?

Key. 1. 1616: 2 for parameters, 2 for gradients, 12 for the Adam terms. 2. B zero means the model starts as the base; A random means B still gets a non-zero gradient. 3. NF4, double quantisation, paged optimisers; the matrix multiply and the adapters stay in 16-bit. 4. No, it saves activations and costs recompute. 5. 16P/N16P/N; about 1.5 times the communication of data parallelism. 6. Over-optimising a reward model that is only accurate near the SFT model. 7. The policy and a frozen reference; the reference log-probabilities can be computed once and reused. 8. (reward−group mean)÷group standard deviation(\text{reward} - \text{group mean}) \div \text{group standard deviation}, with no critic. 9. Related rows in both sets make the evaluation look better than it is. 10. Frozen layers still need input gradients; only the weight gradients are skipped. 11. Swap: one base in memory, many small adapters, rollback by pointer. 12. Re-embedding and re-indexing the whole corpus, and re-checking similarity thresholds.

Mock plan (45 minutes)

MinutesPartPrompt
0 to 5Warm-up“Fine-tune or use RAG for our internal docs assistant?” Follow-up: “They insist on tuning. What would you tune, and how do you prove value?”
5 to 15Depth“Explain LoRA and derive the trainable parameters for a config I give you.” Follow-up: “QLoRA: where does the memory go?”
15 to 22Debug“Your tuned model regressed on general tasks.” Follow-up: “How would you have caught it before shipping?”
22 to 28Alignment“DPO, RLHF or GRPO for a maths tutor?” Follow-up: “Give an example of reward hacking and a defence.”
28 to 43DesignThe design drill, with the interviewer probing data, gate, rollback and cost
43 to 45Close“What are the three biggest risks, and what do you measure first?”

The interviewer does not teach during the mock. Afterwards, note the two places you lost the thread and repeat those drills on a nearby variant a few days later.

Real-World Application

Run the mock with a friend. A 35-minute version: the opener, two derivations and the design drill. A 45-minute version: the full plan, where the interviewer changes a constraint twice. A good habit is to record yourself answering the design drill cold, then count how many of the nine parts you reached before time ran out.

Interview Perspective

Expect all of the above in any order. Signals interviewers tend to look for: you ask what failed before naming a method; you put a baseline and a gate in front of any tune; you give formulas with stated assumptions and say what they omit; you separate task gains from regression and safety; and you say when not to tune.

Common failures are quoting 16 bytes per parameter and forgetting activations, claiming LoRA is a hundredfold saving in compute, and describing a design without a rollback. Another is to quote a library default from memory when the version may have changed.

Provenance: Common industry pattern and Generated practice. None of these drills is verified as asked by a named company.

Practice Questions

  • Basic: Give the 90-second answer to “Should we fine-tune?”
  • Intermediate: Redo B2 for hidden size 2,560, 32 layers, intermediate size 6,912, rank 8, all linear layers.
  • Advanced: Run the design drill with the constraint “the data may not leave our network”. What changes?
  • Product-Company: A manager wants a tune “because it will pay for itself in a month”. What do you ask for?

Activity

Time yourself on the opener and one derivation. If either takes more than twice its budget, mark the lesson it comes from and re-read that section, then try a nearby variant instead of the same prompt.

Homework

Record yourself on the design drill in 40 minutes. Play it back and list what the key covers that you missed. Rewrite your first sixty seconds so that it names the failure, the baseline, and the order you will cover things.

Quick Revision

  • Opener: sort the failure, beat the baseline, test the break-even against caching, LoRA first, gate, canary, re-run on a new base.
  • Memory: full fine-tuning 16P16P; LoRA 2P2P plus 16×adapter16 \times \text{adapter}; QLoRA 0.5P0.5P plus 16×adapter16 \times \text{adapter}; ZeRO 16P16P, 4P+12P/N4P + 12P/N, 2P+14P/N2P + 14P/N, 16P/N16P/N. All are floors.
  • Adapter parameters: r×(din+dout)r \times (d_{\text{in}} + d_{\text{out}}) per matrix, summed.
  • Time: 6ND6ND over the sustained rate; LoRA about two thirds.
  • DPO loss: −ln⁡σ(β×difference of log-ratios)-\ln \sigma(\beta \times \text{difference of log-ratios}); larger beta saturates sooner.
  • Design in nine parts, and diagnose by naming causes in order, then the first check.

Check yourself

  • Walk-through: Design the ticket-triage program in forty minutes, covering all nine parts.
  • Variation: Redo it for a legal-document summariser with strict citations.
  • Common misconception: “A bigger tune is a better answer.” Each step should trace to a failure and a baseline.

Resources & Further Reading

Checked sources to go deeper. The essential ones come first in each group.

Official documentation

Hands-on

More for this module: Fine-tuning resources

Practice

Test what you just read. Quizzes and cards are grouped by module: Fine-tuning.

Check yourself19 questions on what this lesson set out to teach

Checking answers needs JavaScript. You can still read every question and option below.

0 of 19 answered

Keyboard: arrow keys move between options. Space or Enter selects the focused option.

ObjectiveGive a 90-second answer to whether a team should fine-tune, covering the failure kind, the baseline a tune must beat, the break-even against a cheaper alternative, and the upkeep.

  1. Question 1 of 19A support bot quotes outdated prices. The board asks whether to fine-tune it. Which opening shows the best judgement?

    Choose one answer.

  2. Question 2 of 19A tune would save the cost of a long fixed prefix on every call. Which step of the opener tests whether the project is worth it?

    Choose one answer.

  3. Question 17 of 19A tune shipped six months ago and a stronger base model is now available. What is the first step?

    Choose one answer.

  4. Question 18 of 19Which comparison decides whether a tune has earned its place?

    Choose one answer.

ObjectiveWork the memory derivations: model states of full fine-tuning at 16 bytes per parameter, the trainable parameters of a stated LoRA setup, QLoRA states, and ZeRO per-GPU states, and say what each estimate leaves out.

  1. Question 3 of 19Full fine-tuning of a 3B-parameter model with Adam in mixed precision. About how many GB of model states?

    Choose one answer.

  2. Question 4 of 19LoRA at rank 8 on the query and value projections only, in a decoder with hidden size 1,024, square projections and 12 layers. How many trainable parameters?

    Choose one answer.

  3. Question 5 of 19QLoRA on a 20B model with an adapter of 0.5 percent gives about 11.9 GB of states, including the quantisation constants. A team has a 12 GB card. Will it train?

    Choose one answer.

  4. Question 6 of 19A 20B model is fully tuned on 8 GPUs of 80 GB. What are the model states per GPU under ZeRO-2?

    Choose one answer.

ObjectiveWork a training-time estimate from 6ND with LoRA at about two thirds, and the DPO loss for given log-ratios, and say what a larger beta does.

  1. Question 7 of 19A 3B model is trained on 20 million tokens for 3 epochs on one GPU sustaining 200 TFLOP/s. Full tuning takes about 1.5 hours. About how long does a LoRA run take?

    Choose one answer.

  2. Question 8 of 19Why does LoRA cost about two thirds of full fine-tuning compute and not far less?

    Choose one answer.

  3. Question 9 of 19DPO with beta 0.5. The preferred answer has log-ratio +0.4 and the rejected answer -0.8. What is the loss for this pair?

    Choose one answer.

  4. Question 10 of 19One pair has a preferred log-ratio higher than the rejected one, and both stay fixed while beta rises from 0.1 to 0.5. What happens?

    Choose one answer.

ObjectiveStructure a 40-minute answer to design a fine-tuning program, from clarifying questions and a baseline through data, method, evaluation gate, rollout and upkeep.

  1. Question 11 of 19A platform sends a 1,200-token prompt on 3 million tickets a day, and the board asks about tuning. After clarifying goals, what is the next step in a strong answer?

    Choose one answer.

  2. Question 12 of 19A tuned small model beats the baseline on average accuracy. Which addition makes the ship decision defensible?

    Choose one answer.

  3. Question 13 of 19The 60,000 tickets come from threads of several tickets each. How should the held-out set be chosen?

    Choose one answer.

  4. Question 19 of 19A LoRA adapter has passed the gate. Which rollout plan fits the design answer?

    Choose one answer.

ObjectiveDiagnose a described symptom, such as a clean loss with broken output, a fall in general ability or a score that jumped after a data refresh, by naming the likely causes in order and the first thing to check.

  1. Question 14 of 19Training loss is smooth and low, yet the tuned model returns broken JSON in production. What is the best first check?

    Choose one answer.

  2. Question 15 of 19The offline score jumped 15 points after a data refresh, but production did not move. Which check comes first?

    Choose one answer.

  3. Question 16 of 19After tuning, the task score rose and a general-ability benchmark fell. What is the best first check?

    Choose one answer.