Distill Classifier
Most production LLM calls are not agents — they are classifiers: tag, route,
score, extract. This worker replaces a frontier classifier with a fine-tuned
open-weight student using teacher-as-labeler hard-label distillation: an
ensemble of teachers votes labels onto unlabeled rows, the student trains on the
consensus, and a gated verdict decides whether it ships. It does not cover
reasoning or tool-calling workloads — for those use
../compare-trajectories/SKILL.md and the
training rungs it feeds.
Decision Gate
Right move when the task is knowledge-bound classification (domain label
boundaries, not instruction-following), call volume justifies a ~$5–15
experiment, and either the teacher's logits are closed (hard labels are all you
can get) or several teachers are available. Wrong move when prompt optimization
hasn't been tried — run ../optimize-workload/SKILL.md
(GEPA) first; it has moved classifiers +8pp accuracy with no weight update, and
SFT is only warranted after it plateaus against a measured baseline.
Safety Gates
- Do not upload source files, prompts, traces, labels, or datasets unless the
developer explicitly approves that exact action in the current thread.
Teacher-labeling calls send rows to providers — name the row count and get
approval before the sweep.
- Frozen splits before any labeling: train/dev/holdout from
../capture-evidence/SKILL.md, with a
leakage check across splits. Teachers label train only; dev is for
checkpoints; holdout is scored once, at the end.
- Never report accuracy on imbalanced classes — macro-F1 and per-class recall
are the promotion metrics; accuracy hides class collapse.
- Run the confound ablations (see
reference.md) before attributing any lift
to training.
Flow
- Baseline the teachers. Score ≥2 (prefer 3) frontier/strong models on a
balanced labeled sample (≥200 rows/class). Record per-model macro-F1 and
per-class recall. Pick the N best teachers — mean teacher quality
predicts student quality; teacher diversity does not (confirmed null, see
reference.md).
- Try the no-weight rung. GEPA on train rows only. If macro-F1 lands
within ~3pp of the best-teacher ceiling, stop — ship the prompt.
- Consensus-label train. Each teacher labels every train row; majority
vote per row (per label for multi-label). Keep ≥80% of rows: volume
beats purity — strict confidence filtering measurably hurts (−8pp
macro-F1 in the controlled comparison). Set the split-vote rows aside as
the disagreement set.
- Build a failure-directed corpus. Run the student zero-shot on train;
build the SFT set as roughly 60–70% student-miss rows (consensus label the
student got wrong) plus 30–40% unanimous correct rows balancing the
minority class to ~50/50. Targeting residual failures beats a larger
clean-unanimous corpus.
- LoRA SFT. One epoch, conservative LR, and LoRA rank ≥64 — r32 and
below cannot override the base model's class prior and collapses minority
recall (the single most load-bearing hyperparameter measured; details in
reference.md). Train locally via
../local-distillation-lab/SKILL.md
or export the JSONL for a hosted SFT job (approval-gated; size it with
../plan-hosted-run/SKILL.md).
- Validate, then verdict. On dev: macro-F1 vs best teacher, per-class
recall ≥50% everywhere, schema-validity 100% for structured output. Then
one holdout pass and a four-way verdict:
- PROMOTE — beats the bar at ≤ the cost target → route it
(
../use-understudy-gateway/SKILL.md).
- SHADOW-TEST — passes overall but a critical class is marginal.
- COLLECT-MORE-DATA — holdout too thin (<~120 rows) to decide.
- STOP — far below bar after GEPA and SFT; do not iterate
hyperparameters more than twice — the ceiling is the data or the task.
- Escalation (optional). If the student plateaus exactly on the
disagreement set and an open teacher with logits is available, soft-target
distillation on that boundary slice is the next rung (measured +7.9pp on
ambiguous classes; see
reference.md).
Output Standard
End with: the frozen split ids and row counts; the teacher panel with
per-teacher macro-F1; the consensus yield and disagreement-set size; the SFT
corpus composition (failure-directed mix, balance ratio, LoRA rank); the dev
and one-shot holdout table (macro-F1, per-class recall, schema validity,
cost/call vs incumbent); the confound ablations run; the four-way verdict; the
result type (dry-run, validation, heldout); and the one recommended next
command or handoff.
References
1---2name: distill-classifier3description: Use when a developer wants to replace an expensive frontier model on a classification workload (binary, multi-class, multi-label, or structured extraction) with a fine-tuned open-weight student — "distill this classifier", "can a small model do this tagging job", "the frontier labels these for $X, make it cheaper", "consensus-label my data". Multi-teacher majority-vote labeling, failure-directed SFT data, and a four-way promote/shadow/collect/stop verdict.4---56# Distill Classifier78Most production LLM calls are not agents — they are classifiers: tag, route,9score, extract. This worker replaces a frontier classifier with a fine-tuned10open-weight student using **teacher-as-labeler hard-label distillation**: an11ensemble of teachers votes labels onto unlabeled rows, the student trains on the12consensus, and a gated verdict decides whether it ships. It does not cover13reasoning or tool-calling workloads — for those use14[`../compare-trajectories/SKILL.md`](../compare-trajectories/SKILL.md) and the15training rungs it feeds.1617## Decision Gate1819Right move when the task is **knowledge-bound classification** (domain label20boundaries, not instruction-following), call volume justifies a ~$5–1521experiment, and either the teacher's logits are closed (hard labels are all you22can get) or several teachers are available. Wrong move when prompt optimization23hasn't been tried — run [`../optimize-workload/SKILL.md`](../optimize-workload/SKILL.md)24(GEPA) first; it has moved classifiers +8pp accuracy with no weight update, and25SFT is only warranted after it plateaus against a **measured baseline**.2627## Safety Gates2829- Do not upload source files, prompts, traces, labels, or datasets unless the30 developer explicitly approves that exact action in the current thread.31 Teacher-labeling calls send rows to providers — name the row count and get32 approval before the sweep.33- Frozen splits before any labeling: train/dev/holdout from34 [`../capture-evidence/SKILL.md`](../capture-evidence/SKILL.md), with a35 leakage check across splits. Teachers label **train only**; dev is for36 checkpoints; holdout is scored once, at the end.37- Never report accuracy on imbalanced classes — macro-F1 and per-class recall38 are the promotion metrics; accuracy hides class collapse.39- Run the confound ablations (see `reference.md`) before attributing any lift40 to training.4142## Flow43441. **Baseline the teachers.** Score ≥2 (prefer 3) frontier/strong models on a45 balanced labeled sample (≥200 rows/class). Record per-model macro-F1 and46 per-class recall. Pick the **N best** teachers — mean teacher quality47 predicts student quality; teacher *diversity* does not (confirmed null, see48 `reference.md`).492. **Try the no-weight rung.** GEPA on train rows only. If macro-F1 lands50 within ~3pp of the best-teacher ceiling, stop — ship the prompt.513. **Consensus-label train.** Each teacher labels every train row; majority52 vote per row (per *label* for multi-label). Keep ≥80% of rows: **volume53 beats purity** — strict confidence filtering measurably hurts (−8pp54 macro-F1 in the controlled comparison). Set the split-vote rows aside as55 the disagreement set.564. **Build a failure-directed corpus.** Run the student zero-shot on train;57 build the SFT set as roughly 60–70% student-miss rows (consensus label the58 student got wrong) plus 30–40% unanimous correct rows balancing the59 minority class to ~50/50. Targeting residual failures beats a larger60 clean-unanimous corpus.615. **LoRA SFT.** One epoch, conservative LR, and **LoRA rank ≥64** — r32 and62 below cannot override the base model's class prior and collapses minority63 recall (the single most load-bearing hyperparameter measured; details in64 `reference.md`). Train locally via65 [`../local-distillation-lab/SKILL.md`](../local-distillation-lab/SKILL.md)66 or export the JSONL for a hosted SFT job (approval-gated; size it with67 [`../plan-hosted-run/SKILL.md`](../plan-hosted-run/SKILL.md)).686. **Validate, then verdict.** On dev: macro-F1 vs best teacher, per-class69 recall ≥50% everywhere, schema-validity 100% for structured output. Then70 one holdout pass and a four-way verdict:71 - **PROMOTE** — beats the bar at ≤ the cost target → route it72 ([`../use-understudy-gateway/SKILL.md`](../use-understudy-gateway/SKILL.md)).73 - **SHADOW-TEST** — passes overall but a critical class is marginal.74 - **COLLECT-MORE-DATA** — holdout too thin (<~120 rows) to decide.75 - **STOP** — far below bar after GEPA *and* SFT; do not iterate76 hyperparameters more than twice — the ceiling is the data or the task.777. **Escalation (optional).** If the student plateaus exactly on the78 disagreement set and an open teacher with logits is available, soft-target79 distillation on that boundary slice is the next rung (measured +7.9pp on80 ambiguous classes; see `reference.md`).8182## Output Standard8384End with: the frozen split ids and row counts; the teacher panel with85per-teacher macro-F1; the consensus yield and disagreement-set size; the SFT86corpus composition (failure-directed mix, balance ratio, LoRA rank); the dev87and one-shot holdout table (macro-F1, per-class recall, schema validity,88cost/call vs incumbent); the confound ablations run; the four-way verdict; the89result type (dry-run, validation, heldout); and the one recommended next90command or handoff.9192## References9394- [`reference.md`](reference.md) — quantified findings (dated), the three95 confounds with prevention, corpus/training defaults, and the verdict96 thresholds.97- [`../optimize-workload/SKILL.md`](../optimize-workload/SKILL.md) — the98 no-weight rung; use first when failure attribution says prompt or contract99 repair can close the gap, otherwise proceed to the capacity-changing path.100- [`../local-distillation-lab/SKILL.md`](../local-distillation-lab/SKILL.md) —101 local training arms and the weight-update proof discipline.102- [`../curate-trajectories/SKILL.md`](../curate-trajectories/SKILL.md) — split103 hygiene for the labeled selections.104- [`../compare-model-sweep/SKILL.md`](../compare-model-sweep/SKILL.md) —105 Pareto framing once a student candidate exists.