Fine-tuning, RLHF & Alignment·Question 53 of 61Advanced

Design a pipeline to distil a frontier model's performance on your task into an 8B model you can serve yourself. Walk me through the whole thing.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The shape is: prompt distribution, teacher generation, filtering, SFT, on-policy refinement, eval gate. The filtering and the on-policy step are where the quality actually comes from.

Full worked answer

The shape is: prompt distribution, teacher generation, filtering, SFT, on-policy refinement, eval gate. The filtering and the on-policy step are where the quality actually comes from.

1. Prompts first. The prompt distribution matters more than the responses. Pull real production prompts, scrub PII, check consent. Synthetic prompts drift off-distribution and you end up with a model that is great at problems nobody has. Cluster and rebalance so the tail is represented. Target ~20-50k prompts.

2. Teacher generation. Sample k=4-8 completions per prompt at temperature ~0.7-1.0. Check the teacher's terms of use first: several API providers prohibit training competing models on their outputs, and legal will kill this at the last minute otherwise. Open-weight teachers with permissive licences avoid the question entirely.

3. Filter, do not dump. This is rejection fine-tuning. Where a verifier exists (tests, schema, answer key), keep only passing completions. Where it does not, use a judge or reward model, keep the best per prompt, and drop prompts where every sample fails, because those teach the model to be confidently wrong. Expect to discard 30-60%. Dedup and decontaminate here.

4. SFT the 8B on the filtered set: correct chat template, loss masked to response tokens.

5. The step people skip: on-policy distillation. Offline SFT only ever shows the student the teacher's distribution, so the student's own characteristic errors are never corrected, and you get exposure bias at inference. Sample from the student, have the teacher score or correct those samples, train on that. If teacher and student share a tokenizer and you can get teacher log-probs, score the student's own samples token by token against the teacher (a per-token reverse KL, the GKD / on-policy distillation setup), which carries far more signal per token than hard labels. Otherwise use the teacher as a judge and run a preference round.

6. Eval gate. Side-by-side against the teacher on a held-out set, plus latency and cost per request. Be honest about the ceiling: distillation transfers narrow behaviour and format reliably, and does not transfer general capability. If the task needs broad reasoning, an 8B may simply not get there. That is a valid finding, not a failure.

7. Flywheel. Route low-confidence production traffic to the teacher; those become next round's data.

What a good answer covers

  • The shape is: prompt distribution, teacher generation, filtering, SFT, on-policy refinement, eval gate
  • The filtering and the on-policy step are where the quality actually comes from
  • The prompt distribution matters more than the responses
  • Pull real production prompts, scrub PII, check consent
  • Synthetic prompts drift off-distribution and you end up with a model that is great at problems nobody has

Key terms: 1. Prompts first · 2. Teacher generation · 3. Filter, do not dump · 4. SFT the 8B · 6. Eval gate · 7. Flywheel

Interviewer follow-ups to expect

  1. How would you decide the routing threshold between student and teacher in production?

  2. What changes if the teacher and student have different tokenizers and you only have text outputs?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep