The last rung of the adaptation ladder (pb-27): your frontier-model pipeline passes evals, but the invoice or the latency does not.
Tier: Advanced · Workflow area: Fine-tuning & Model Adaptation
Distillation uses the expensive model as a teacher — labeling data at scale — and trains a small student to match it: an 8B open model, or even a gradient-boosted classifier when the task is secretly classification. Production teams (the Netflix/Uber-style platform pattern) use this constantly to cut serving cost 10–100x while keeping most of the quality. This playbook builds the teacher→student pipeline and, critically, the eval parity report that says exactly what you gave up.
Skip for low-volume tasks (the API bill is smaller than the engineering time) and for open-ended reasoning tasks where small students fall off a quality cliff — check the small-model baseline from pb-27 first.
Decide the student class by task shape. Fixed label set or score → LLM→GBM/logistic path: teacher emits labels, student is XGBoost/logistic over embeddings or engineered features; serving cost approaches zero. Structured or free text out → LLM→SLM path: teacher emits target outputs, student is a 1–8B model SFT-tuned on them (pb-28/29 mechanics apply unchanged).
Design the labeling prompt for training data, not for chat. The teacher prompt should produce the exact output format the student will be trained to emit — schema-validated JSON, canonical label strings — plus a confidence field. Pin the teacher model version and temperature 0; log every call (prompt hash, model, timestamp) so the dataset is reproducible.
Label with quality controls. Run the teacher over your 5k–50k inputs via the batch API. Then: (a) drop or re-queue low-confidence labels; (b) label 3–5% of inputs twice (paraphrased prompt or second teacher) and measure agreement — under ~90% agreement means the task definition is fuzzy, fix the prompt before scaling; (c) human-audit 100 random labels against the rubric. Decontaminate against the eval set exactly as in pb-28.
Train the student. GBM path: embed inputs with a small open embedder (or the pb-31 tuned one), fit XGBoost with standard CV, calibrate probabilities (Platt/isotonic) — calibph matters because you will threshold on it. SLM path: SFT per pb-29 (LoRA on a 3–8B base, teacher outputs as gold), 1–2 epochs.
Write the eval parity report. On the original human-grounded eval set (not teacher labels — the teacher is now an interested party), report teacher vs student vs untrained-small-model baseline: task metric, per-slice deltas, worst-100-case review, plus cost/1k requests and p95 latency for each. The deliverable is one table: quality gap vs cost gap.
Route around the student's weaknesses. If parity fails only on identifiable slices, ship a router: student handles the easy majority, low-confidence or hard-slice inputs escalate to the teacher. Even a crude confidence threshold typically preserves ~95% of quality at a fraction of cost — report the blended cost/quality point too.
Set the re-distillation trigger. Log student confidence and sampled teacher-agreement in production; when agreement drifts below a set floor, or the upstream task shifts, re-run the pipeline. Distillation is a build you re-run, not a one-off.
The student can only be as good as the teacher on your task — distillation transfers behavior, mistakes included. Every hour spent hardening the teacher's eval before distilling pays back at 10,000-request scale.
Check the teacher's terms of service — some providers restrict using outputs to train competing models; enterprise agreements usually carve out internal task-specific distillation, but that is a contract question, not an engineering one.