FoundationsChecking saved investigationReading browser-local route memory before showing a continuation.

Foundation Lab

Efficiency: Quantization, Distillation, LoRA & Sparse MoE

Quantization + LoRA are standard for deploying and fine-tuning Llama-class models on modest GPUs

Concept 16 of 100EfficiencyPhase 8
#16EfficiencyEfficiency
key equationW' = W + BA,\quad r \ll d

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 16 of 100EfficiencyEfficiency / Phase 8: Scaling, theory & multimodal
Current question

Geometric views of low-rank updates: LoRA as adding a small, oriented "slice" in weight space

W' = W + BA,\quad r \ll d
PredictionCommit before the demo.

Ask what should change when the equation is manipulated, then let the visualization test that expectation.

EvidenceCompare local witness and source.

Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue in the newer notebook.

This atlas page keeps the working demo; the domain notebook carries the fuller Intuition -> Math -> Code -> Demo sequence.

Why It Matters for Modern Models

  • Quantization + LoRA are standard for deploying and fine-tuning Llama-class models on modest GPUs
  • Distillation compresses large base models into "small assistants"
  • MoE/Switch-style sparsity powers very large Google-scale models (likely Gemini)

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Geometric views of low-rank updates: LoRA as adding a small, oriented "slice" in weight space
  • Intuitive trade-offs in quantization: how error propagates, why some layers are more sensitive

Interactive Visualization

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.

Key Equation
W=W+BA,rdW' = W + BA,\quad r \ll d

Distillation: train student qψq_\psi to match teacher pθp_\theta:

L=T2KL(pθT(x)qψT(x))\mathcal L = T^2\,\mathrm{KL}(p_\theta^T(\cdot\mid x)\,\|\,q_\psi^T(\cdot\mid x))

Quantization: map float weights to low-bit integers: w~=Δround(w/Δ)\tilde w = \Delta \cdot \mathrm{round}(w/\Delta)

LoRA: re-parameterize weight matrix as: W=W+BAW' = W + BA, where BRd×r,ARr×d,rdB\in\mathbb R^{d\times r}, A\in\mathbb R^{r\times d}, r\ll d — only train A,BA,B, freezing WW.

Sparse MoE: FFN layers replaced by many experts fef_e, with router: FFNMoE(x)=fe(x)(x)\text{FFN}_{\text{MoE}}(x) = f_{e^*(x)}(x)

Canonical Papers

Distilling the Knowledge in a Neural Network

Hinton et al.2015NeurIPS Workshop
Read paper →

LoRA: Low-Rank Adaptation of Large Language Models

Hu et al.2021ICLR
Read paper →

Switch Transformers: Scaling to Trillion Parameter Models

Fedus et al.2021JMLR
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.