Domain

Efficiency

Ways to make models cheaper to train and serve: quantization, distillation, low-rank adapters, pruning and sparse experts, and the memory, latency and accuracy each one trades.

5 notebooks5 demos
Preview the recommended route
First notebookKnowledge Distillation: Learning from Teachers

Start here. Make one prediction, then note what carries over to the next notebook.

Wbitsmemorylatency
Open first notebook
QuestionWhat carries over from Knowledge Distillation into Efficiency?
PredictionBefore opening the first demo, predict which quantity changes first.
Demos5 interactive demos in this domain
Before moving onSay in one sentence how the idea works before going to the next notebook.
LearnerWhich notebook should I read first?

Read the first notebook, make one prediction in its demo, then go on to the next.

Open the first notebook

Recommended route

Read these in order: each notebook comes after the notebooks in this domain that it builds on, and the label beside it gives its level. A prerequisite with no page here yet is marked as outside reading. A notebook is left out of the route only when a prerequisite has neither a page here nor a named outside reading; the full list below marks it.

  1. 01
    Knowledge Distillation: Learning from Teachers

    Knowledge distillation trains a student, usually smaller, to match a teacher's temperature-softened output probabilities, often alongside the true labels. The probabilities the teacher gives to wrong classes show which classes it treats as similar, which hard labels omit.

    Intermediate16 mincodedemoafter Maximum Likelihood, Label Smoothing & Soft Targets
  2. 02
    Efficiency: Quantization, Distillation, LoRA & Sparse MoE

    Four common ways to make large models cheaper to run or adapt: quantize weights and activations, distill a teacher into a smaller student, train a low-rank update (LoRA) or route each token to a few experts (sparse MoE).

    Advanced20 mincodedemoafter Maximum Likelihood, Scaled Dot-Product Attention & Transformer Layers, Loss Landscapes, Sharpness & Flat Minima
  3. 03
    Pruning Weights and Channels

    Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.

    Intermediate20 mincodedemoafter Efficiency: Quantization, Distillation, LoRA & Sparse MoE, Weight Initialization: Xavier, He & muP

    Pruning Weights and Channels builds directly on Efficiency.

  4. 04
    Quantization: Compressing Models to Integers

    Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.

    Intermediate16 mincodedemoafter Efficiency: Quantization, Distillation, LoRA & Sparse MoE, LLM Serving at Scale: Prefill, Decode & Continuous Batching
  5. 05
    Sparse Mixture of Experts: Routing, Load Balancing & Expert Parallelism

    Conditional computation: a router picks a few experts per token. You can increase total expert parameters while keeping activated expert FFN compute small, but distributed systems may pay in communication and scheduling.

    Advanced20 mincodedemoafter Scaled Dot-Product Attention & Transformer Layers, Maximum Likelihood, Efficiency: Quantization, Distillation, LoRA & Sparse MoE

All notebooks

Every published notebook in this domain.