When considering knowledge distillation, “a smaller model must be cheaper” can hide the cost of generating teacher data, checking quality, repeating training, and keeping an underused GPU running. The first question is whether enough work will consistently meet the required quality to recover the initial investment.
This article explains teacher-to-student knowledge transfer and separates data generation, training, evaluation, and production operation. Every price and acceptance rate below is an illustrative assumption. These are not results from model training, billed API calls, or GPU speed measurements. The Python example performs arithmetic only and makes no external requests.
What knowledge distillation changes—and what it does not
Knowledge distillation trains a student using signals such as a teacher model’s outputs. The original paper by Hinton and colleagues describes transferring an ensemble’s knowledge into a single model that is easier to deploy. It does not guarantee that the smaller model retains every capability of its teacher.
For LLMs, one approach uses generated answers as training material. Classical distillation can instead use information such as class probability distributions. An API that returns a teacher’s answer text does not necessarily provide internal probability distributions or intermediate representations. Distinguish the outputs you can access from the learning objective you intend to implement.
| Option | What mainly changes | First validation |
|---|---|---|
| Call the teacher API directly | Prompts, inputs, and request handling | Real-task quality, latency, and recurring charges |
| Use an existing small model as-is | Model selection | Whether it already meets requirements without distillation |
| Fine-tuning | Pretrained model weights | Data quality and separation of evaluation data |
| Knowledge distillation | Teacher-provided material or learning signals, and student weights | Usage rights, transferred quality, and retraining cost |
| Quantization | Numerical precision of weights and other values | Quality and memory in the target runtime |
Distillation and fine-tuning are not mutually exclusive. A student can be fine-tuned on material generated by a teacher. If quantization is added, evaluate quality after distillation and again after quantization. The existing guides to single-GPU LLM fine-tuning and quantization quality and memory address those separate decisions.
Keep four cost stages separate
Instead of putting everything under “training,” maintain four cost categories. Include failed trials whenever they actually incurred costs.
| Stage | Inputs to record | Gate to pass |
|---|---|---|
| 1. Teacher-data generation | Teacher inputs and outputs, retries, deduplication, human review | Check permitted use, personal information, and answer quality |
| 2. Student training | GPU time, storage, trial count, and staff time | Freeze data and settings so training can be reproduced |
| 3. Evaluation | Independent questions, scoring, human checks, and load tests | Meet task-quality and operating requirements together |
| 4. Production operation | Reserved or usage-based GPUs, idle time, monitoring, incident work, and redistillation | Make total costs work at the actual workload volume |
Smaller weights do not imply that total production memory falls in the same proportion. Account for input length, concurrency, KV cache, and runtime workspace. If incorrect teacher answers enter the training material unchanged, the student may learn those errors. Data volume alone is not a quality test.
The official PyTorch knowledge-distillation tutorial is a technical starting point. Its image-classification results and environment requirements are not evidence for your LLM speed, GPU cost, or quality. This article does not present that tutorial’s accuracy as our own result.
Use accepted answers as the common denominator
A cheap request is not necessarily a cheap answer that meets the quality bar. First define acceptance criteria using independent evaluation questions. Track requirements such as correct classification, valid JSON, absence of prohibited information, and answer grounding separately.
The simplified model below executes each item once and excludes failed answers from accepted output. Cost per accepted answer equals cost per execution divided by acceptance rate. Monthly cost is fixed monthly cost plus the number of required accepted answers times that unit cost. Monthly savings are the teacher’s monthly cost minus the student’s; payback months equal initial investment divided by monthly savings. The original calculation notation is preserved here:
合格回答1件あたりの変動費
= 実行1回の変動費 / 合格率
月の費用
= 月固定費 + 必要な合格回答数 × 合格回答1件の変動費
月の差額
= 教師を直接使う月費用 - 生徒を使う月費用
回収月数
= 初期投資 / 月の差額
If the system retries or falls back to the teacher, count those extra charges and avoid counting the same accepted result twice. The reciprocal of acceptance rate is not a measured retry count. Errors are not necessarily independent: repeating the same input may not improve the result.
A monthly GPU reservation belongs in fixed monthly cost. Including the same charge in variable cost would count it twice. Conversely, a usage-time estimate that ignores billed idle time understates operating cost.
Calculate payback with explicit hypothetical inputs
These are assumptions, not market prices or a Flatkey quotation. USD is used only to keep the arithmetic consistent.
| Input | Assumption |
|---|---|
| Training-material generation and review | $600 |
| Training and failed trials | $900 |
| Independent evaluation and deployment preparation | $500 |
| Total initial investment | $2,000 |
| Teacher variable cost per execution | $0.010 |
| Teacher acceptance rate | 95% |
| Student variable cost per execution | $0.002 |
| Student acceptance rate | 90% |
| Additional student fixed monthly cost | $300 |
Under these assumptions, variable cost per accepted answer is approximately $0.010526 for the teacher and $0.002222 for the student, a difference of about $0.008304. Covering the student’s extra $300 monthly fixed cost requires approximately 36,127 accepted answers per month just to equal recurring costs. That has not yet recovered the initial investment.
| Required accepted answers per month | Teacher monthly cost | Student monthly cost | Monthly savings | Initial-investment payback |
|---|---|---|---|---|
| 20,000 | $210.53 | $344.44 | −$133.92 | Not recovered under these conditions |
| 100,000 | $1,052.63 | $522.22 | $530.41 | About 3.77 months |
| 300,000 | $3,157.89 | $966.67 | $2,191.23 | About 0.91 months |
Looking only at cost per execution makes the student appear cheaper in every case. Fixed cost dominates at low volumes. This table also excludes future redistillation, falling traffic, exchange rates, tax, and additional legal review. Add the categories that apply to your project before deciding.
Recalculate in Python without external requests
This example uses only Python 3’s standard library. It performs cost arithmetic, not teacher generation or student training. Before replacing assumptions with measurements, check units and duplicated costs.
from decimal import Decimal, ROUND_CEILING
D = Decimal
initial = D('600') + D('900') + D('500')
teacher_cost = D('0.010')
student_cost = D('0.002')
teacher_pass = D('0.95')
student_pass = D('0.90')
student_fixed = D('300')
if not (D('0') < teacher_pass <= D('1')):
raise ValueError('teacher_pass must be in (0, 1]')
if not (D('0') < student_pass <= D('1')):
raise ValueError('student_pass must be in (0, 1]')
teacher_unit = teacher_cost / teacher_pass
student_unit = student_cost / student_pass
unit_saving = teacher_unit - student_unit
if unit_saving <= 0:
raise ValueError('No variable-cost advantage')
minimum = (student_fixed / unit_saving).to_integral_value(
rounding=ROUND_CEILING
)
print('monthly_break_even_accepted=', minimum)
for accepted in [20000, 100000, 300000]:
teacher = D(accepted) * teacher_unit
student = student_fixed + D(accepted) * student_unit
saving = teacher - student
payback = 'not_recovered'
if saving > 0:
payback = f'{initial / saving:.2f}'
print(accepted, f'{teacher:.2f}', f'{student:.2f}',
f'{saving:.2f}', payback)
The last output column is payback in months. Savings are calculated before rounding, so subtracting the displayed costs can differ by one cent.
monthly_break_even_accepted= 36127
20000 210.53 344.44 -133.92 not_recovered
100000 1052.63 522.22 530.41 3.77
300000 3157.89 966.67 2191.23 0.91
Freeze evaluation and usage requirements before training
Separate evaluation data from data used to generate teacher training material. Near-duplicate text from the same case appearing in both sets can overstate quality on unseen inputs. Include representative tasks, long inputs, ambiguous requests, formatting failures, and cases that require abstention. Compare the teacher, an existing small model, and the trained student under the same conditions.
At minimum, record the data version, teacher and student identifiers, generation settings, training-material acceptance rules, training settings, evaluation criteria, input length, concurrency, latency distribution, acceptance rate, and failure-handling process. Consider a separate final test set rather than developing indefinitely against the same evaluation questions after each retraining.
Teacher API outputs, model weights, base models, and input data can each have usage conditions. Being able to obtain an API answer does not establish permission to train or distribute another model. Have the responsible team check the current terms for the exact services and models, recording training-material use, commercial service, redistribution, and personal-data handling. This article does not determine permission for any particular model.
Continue distillation or return to direct use?
Testing whether an existing small model already meets the required quality can reveal that distillation is unnecessary. A large initial investment is harder to justify when direct teacher use is sufficiently cheap, volume is low, the task changes frequently, or evaluation criteria are not settled.
Proceed when the task and quality threshold are clear, training-material usage conditions are satisfied, and the payback period based on sustained volume is acceptable. Continue tracking cost per accepted answer, fallback share, and retraining cost in production. If the economics break down, prior expenditure alone is not a reason to continue.
When comparing hardware, Flatkey’s GPU rental and configuration consultation lets you specify model, dataset size, GPU count, region, and term, and confirm conditions in a formal quotation. The illustrative amounts here guarantee neither price nor availability. Compare direct API use under the same evaluation conditions.
Frequently asked questions
Does knowledge distillation always reduce inference cost?
No. It depends on required quality, volume sufficient to absorb fixed costs, retries, teacher fallback, and redistillation. Cost per small-model execution is not enough to decide.
Should I try distillation or quantization first?
There is no universal order. Check whether existing models and quantization paths satisfy the quality bar, then identify any task gap that distillation must address. Changing several things together makes causes harder to isolate.
Is the payback period an actual deployment result?
No. Every input is hypothetical, and no training or billed test was performed. Replace the inputs with your project’s quality, volume, costs, and usage requirements.
Responsible team: Flatkey Team. Content checked on November 23, 2026. We checked primary technical sources and public documentation and recalculated only the arithmetic in Python. This does not claim independent model-performance measurement, customer deployment evidence, or external expert review. Flatkey provides GPU rental and model APIs; links to our services have a commercial relationship. About the operator · Back to the blog.



