RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
Glossary / Large language models / Knowledge Distillation
Large language models

Knowledge Distillation

Knowledge distillation is a technique where a smaller, faster 'student' model is trained to mimic the behavior of a larger, more accurate 'teacher' model. The student learns from the teacher's output probabilities (soft labels) rather than just the ground-truth labels, capturing the teacher's nuanced decision boundaries. In local AI, distillation produces models that fit in consumer VRAM (e.g., 8 GB) while retaining much of the teacher's capability. For example, a distilled 7B model may approach the performance of a 70B teacher on specific tasks, but runs at ~40 tok/s on an RTX 4090 instead of ~5 tok/s.

Deeper dive

Distillation involves three loss components: (1) hard loss against ground-truth labels, (2) soft loss against teacher logits (softened by a temperature parameter), and (3) optionally, a hidden-state alignment loss. The temperature controls how much the student learns from fine-grained class relationships—higher temperature yields softer probability distributions. Common variants include offline distillation (teacher fixed), online distillation (student and teacher co-trained), and self-distillation (same architecture, earlier checkpoint as teacher). For operators, distillation is relevant because many popular local models are distilled: e.g., Microsoft's Phi-3-mini (3.8B) was distilled from a larger model, and Mistral's 7B series uses distillation from larger Mistral models. Distilled models often use the same tokenizer and architecture as the teacher, so they load into existing inference engines (llama.cpp, Ollama) without modification. The trade-off: distilled models may lack the teacher's breadth on rare topics, but they excel at the teacher's training distribution.

Practical example

A concrete example: Microsoft's Phi-3-mini (3.8B) is a distilled model that fits in 4 GB VRAM at Q4. On an RTX 3060 12 GB, it runs at ~50 tok/s, while the teacher (likely a 70B-class model) would require 48 GB VRAM and run at ~2 tok/s. The distilled model scores ~68% on MMLU vs. the teacher's ~80%, but for many local tasks (chat, code generation), the difference is negligible.

Workflow example

When using Hugging Face Transformers, you can load a distilled model like microsoft/Phi-3-mini-4k-instruct with AutoModelForCausalLM.from_pretrained(...). In Ollama, ollama pull phi3:mini downloads the distilled 3.8B model. The runtime treats it like any other model—no special flags needed. The benefit shows in VRAM usage: ollama run phi3:mini uses ~2.5 GB VRAM, leaving room for a 4K context window.

Reviewed by Eruo Fredoline. See our editorial policy.

Buyer guides
  • Best GPU for local AI →
  • Best laptop for local AI →
  • Best Mac for local AI →
When it doesn't work
  • CUDA out of memory →
  • Ollama running slowly →
  • ROCm not detected →