Skip to main content

AI Distillation Explained: Learning From a Larger Model

9 min read
AI Distillation Explained: Learning From a Larger Model

An organization may need AI to do one job reliably—not every job a leading general-purpose model can attempt.

That could mean classifying service requests, extracting fields from approved documents, or generating a consistent first draft for a reviewer. If a large model performs that task well but is too costly, slow, or difficult to deploy where it is needed, model distillation may offer another route.

The idea is straightforward: use the outputs or training signals of a teacher model to help train a student model. The implementation—and the responsibility for checking what the student learns—is less straightforward.

Distillation can make useful capabilities more accessible. It does not automatically create a smaller equivalent of the world's best AI, eliminate mistakes, or give an organization unrestricted rights to someone else's model.

First, two different meanings of “distillation”

Cobus Greyling's What Andrej Karpathy Learnt — A Distilled Field Guide is a useful starting point for exploring Karpathy's teaching. It organizes ideas from his publicly shared essays, lectures, talks, and code into accessible lessons with links to original sources.

Greyling curated that guide. Karpathy is the source of the teaching it interprets. The guide is not presented here as a publication authored or endorsed by Karpathy.

Its title also illustrates an important distinction:

  • Editorial distillation condenses ideas for a reader.
  • Model knowledge distillation uses a teacher's signals to train another model, changing the student's learned parameters.

Reading a summary—or pasting one into a chatbot—does not, by itself, distill that chatbot. This article concerns the second meaning, while drawing on the guide and Karpathy's original work for practical learning and engineering principles.

Think of an experienced specialist training a colleague

Imagine an experienced support specialist demonstrating how to categorize requests. The colleague practices on examples, receives guidance, and is eventually tested on unfamiliar cases.

Model distillation has a similar structure: a teacher supplies guidance; the student is trained to reproduce selected behavior; independent evaluation determines whether the student is useful.

The analogy has limits. The student is not a person who understands an explanation as we do. Its parameters are adjusted by an optimization process. Fluent explanations do not establish reliable judgment, and imitating correct-looking answers does not guarantee correctness.

The influential 2015 paper by Geoffrey Hinton, Oriol Vinyals, and Jeff Dean, Distilling the Knowledge in a Neural Network, describes transferring knowledge from cumbersome models into a model that is easier to deploy.

Today, “distillation” covers several related techniques. The teacher may be an ensemble rather than one model. Students are often smaller, but smaller size is not the defining requirement: learning from a teacher is.

Two important ways a teacher can teach

1. Learning from generated examples

A teacher receives a collection of prompts and generates answers. A team checks and filters those answers, then uses the selected examples to train a student.

For a language model, the training examples might contain an instruction, relevant context, and the desired response. This is commonly implemented as supervised fine-tuning of an existing student checkpoint.

Where permitted, an API can provide teacher-generated text without exposing the teacher's weights. The organization still needs permission under the applicable terms to use those outputs for training.

Generated explanations or reasoning-style responses can also become training data. They should not be assumed to reveal the teacher's actual internal computation, or to be correct merely because they are detailed.

As a concrete published example, the DeepSeek-R1 project describes fine-tuning existing Qwen- and Llama-based models using reasoning data generated by its larger model. That is evidence of a particular approach—not a guarantee that any organization can reproduce its results on unrelated work.

2. Learning from probabilities, not just final answers

A teacher can provide more information than its chosen output.

Suppose a classification model rates a message as 75% likely to be a billing issue, 20% an account-access issue, and 5% something else. Those illustrative probabilities reveal relationships that the single label “billing” would conceal.

Classical distillation trains a student to match such probability distributions, often alongside ordinary labeled examples. Logits are the scores before conversion into probabilities. Temperature is a mathematical setting that can soften the distribution, making less likely alternatives more visible during training. The original paper explains these mechanisms.

This requires access to appropriate teacher signals. A text-only API response is not the same thing as a complete distribution over every possible next token. Matching distributions between systems can also require compatible tokenization or specialized alignment techniques.

These approaches can be combined. The right method depends on the available teacher access, student architecture, data, rights, and objective.

What resources does distillation actually require?

There are three separate resource budgets. Confusing them is a common source of unrealistic expectations.

Part of the work Hardware or service requirement Software and operating requirement
Produce teacher examples or signals An approved teacher API, or sufficient infrastructure to run the teacher yourself Prompt/data preparation, generation jobs, usage limits, retries, secure storage, and quality filters
Train the student Accelerators and memory sized for the student and training method; potentially distributed compute A training framework, tokenizer, supervised or distillation objective, checkpoints, monitoring, and reproducible configuration
Evaluate and deploy A test environment and then serving capacity for actual traffic Independent evaluation, safeguards, access controls, deployment tooling, versioning, and ongoing monitoring

Using a teacher API does not mean the project needs no compute. It means the provider supplies the teacher's inference compute. Student training and deployment still have to happen somewhere, perhaps through another managed service.

Conversely, self-hosting a large teacher can dominate the infrastructure budget. It may require more resources than the final student will ever need.

For software, a framework such as PyTorch and suitable model libraries provide the basic training machinery. A text-example workflow may use an ordinary supervised fine-tuning trainer; probability-matching distillation needs an implementation of the relevant objective and compatible teacher/student data flow.

An adapter-based approach can reduce the resources used to adapt the student. LoRA keeps base weights frozen and trains smaller update matrices. QLoRA combines low-rank adaptation with a quantized, frozen base. Neither removes the need to hold and execute the base model or manage training activations.

Our companion guide to pre-training and post-training explains those hardware and software differences in more detail.

A smaller model is an opportunity—not proof of savings

A successful smaller student may need less memory or deliver lower latency on a defined workload. That can support local deployment, predictable high-volume processing, or operation in a constrained environment.

But model size alone does not establish the business case.

Count teacher generation, filtering and annotation, training experiments, failed runs, evaluation, engineering time, and ongoing serving. A student that requires repeated retries or extensive human correction may be cheaper per token but more expensive per accepted outcome.

Similarly, lower parameter counts are not direct measurements of electricity use or emissions. Hardware utilization, response length, batching, and facility conditions matter. Our AI efficiency analysis explains why cost, energy per task, and total consumption are different measurements.

For a low-volume workflow, continuing to use a managed general-purpose model may be more sensible than operating a custom student.

A practical example: triaging service requests

Consider a midsize organization that wants incoming requests routed to the right team.

It could start with this illustrative project, not a guaranteed recipe:

  1. Define the job. Choose the permitted categories, escalation rules, output format, and what the model must do when uncertain.
  2. Establish a baseline. Measure rules, a simple classifier, and an existing model before deciding that distillation is necessary.
  3. Prepare authorized examples. Remove unnecessary personal information and prevent sensitive data from reaching an unapproved teacher service.
  4. Generate and check teacher responses. Have knowledgeable staff review a representative selection, especially rare, ambiguous, and consequential cases. Do not label every teacher response correct by default.
  5. Train the student. Choose a permitted base model, train on the approved material, and record the exact data and configuration.
  6. Test on genuinely separate cases. Keep related or duplicate requests from leaking between training and evaluation. Compare routing accuracy, escalation behavior, latency, total cost, and human corrections.
  7. Deploy with limits. Begin with reviewer-visible recommendations, retain an escalation path, monitor drift, and repeat evaluation when models or policies change.

The useful result is not “our own ChatGPT.” It is a demonstrably effective tool for a bounded job.

What the student does not automatically inherit

Distillation transfers behavior through the signals used for training. It does not copy the teacher's entire training history, every capability, or every safeguard.

Important limitations include:

  • Coverage gaps. If examples omit difficult situations, the student may never learn the desired response.
  • Repeated errors. Teacher mistakes, biases, and misleading explanations can become student training material.
  • Capacity limits. A student may not have enough capacity to reproduce complex behavior across many tasks.
  • Safety regressions. Good performance on ordinary questions does not establish resistance to manipulation or appropriate behavior on dangerous requests.
  • Changing information. Training is not a live connection to current company records or the teacher's future improvements.
  • Distribution shifts. Success on familiar test cases may not survive new products, languages, or customer behavior.

A student can perform well—even outperform its teacher on a narrow test—without being generally equivalent. Compare actual systems on the work that matters, including failures and abstentions.

Rights, privacy, and governance are part of the design

Before generating a dataset, review the teacher provider's terms, the student model's license, rights to input material, and any redistribution or commercial-use requirements.

The DeepSeek-R1 repository itself illustrates why this matters: its distilled models use different base-model families with their own licensing considerations. A release's headline license is not a substitute for examining the exact model and dependencies.

Model training can also retain sensitive information from examples. Distillation is not anonymization. Minimize data, control access to datasets and checkpoints, specify retention, and test for inappropriate disclosure.

In regulated or high-consequence settings, involve the appropriate security, legal, and domain specialists before deployment—not after a demonstration appears impressive.

The Karpathy lesson: understand and test what you are building

Karpathy's original A Recipe for Training Neural Networks emphasizes inspecting data, establishing simple baselines, verifying the training pipeline, and prioritizing correctness before elaborate optimization.

His Neural Networks: Zero to Hero teaches neural networks, tokenization, and GPT-style models through building their components.

These are general learning and engineering principles, not a claim that those resources prescribe this article's distillation workflow. They are nevertheless directly relevant: a sophisticated teacher does not rescue a poorly designed dataset or a broken evaluation.

For smaller organizations, the sensible progression is choose a valuable task, measure an existing solution, establish what must improve, and only then decide whether distillation earns its additional complexity.

Distillation is powerful because useful behavior can sometimes be transferred into a system better suited to a particular job. Its value comes from verified results—not from assuming that a smaller model has inherited everything its teacher knows.

Download the AI adaptation decision worksheet

Download the free, three-page AI adaptation decision worksheet (fillable PDF). Record your task, data sensitivity, quality baseline, workload volume, team capability, and budget before comparing prompting, permission-aware retrieval, an existing smaller model, supervised adaptation, or distillation. Save a local copy to fill in or print, and have a human owner and qualified reviewers complete the stop/go checklist.

This is a decision aid, not a readiness assessment, automatic sizing guarantee, or model-training service. Hardware requirements depend on the exact model and configuration.

Sources were reviewed November 29, 2026. Research results describe particular models and experiments, not universal performance guarantees. The banner is an AI-generated editorial illustration; it does not depict an actual model architecture or a person.

Stay Informed

Get the latest AI resources and insights delivered to your inbox