MIT 6.5940: TinyML and Efficient AI Computing (Fall 2026)
Read first: Attention Is All You Need
TL;DR. MIT 6.5940 (EfficientML.ai), taught by Song Han (MIT HAN Lab, author of Deep Compression, SmoothQuant, and AWQ), is the premier open graduate course on making neural networks—and especially modern LLMs, long-context models, and diffusion models—small, fast, and deployable. The Fall 2026 edition refreshes the syllabus with dedicated lectures on LLM quantization and deployment, LLM post-training, long-context LLMs, diffusion acceleration, and distributed training, with all slides and YouTube lectures freely posted.
Why it matters now. Stanford CS336 teaches you how to train an LLM from scratch; MIT 6.5940 teaches you how to compress, quantize, prune, and serve it when memory bandwidth and GPU RAM are the real bottlenecks. For IR and agent engineers running rerankers, long-context tool loops, or local models under tight latency budgets, Chapters I and II are immediately practical.
What to skip on a first read. If your focus is LLMs and agents rather than microcontrollers, skim Lectures 7–8 (NAS) and 10–11 (MCUNet/TinyEngine) and jump straight to Lectures 3–6 (pruning & quantization) and Lectures 12–19 (LLM deployment, post-training, long context, and distributed training). The five coding labs are optional—useful if you want hands-on CUDA/quantization practice, skippable if you want the ideas and systems mental model.
Fall 2026 lecture map
Section titled “Fall 2026 lecture map”Links come directly from the official MIT 6.5940 Fall 2026 course site.
| Lectures | Topic | Key concepts | Pair on Learning Stack |
|---|---|---|---|
| 1–2 | Introduction & Deep Learning Basics | Compute/memory scaling, latency vs. throughput, roofline thinking | GPUs go brrr |
| 3–4 | Pruning and Sparsity (I & II) | Unstructured vs. N:M (2:4) vs. structured pruning, sensitivity, hardware speedup | LLM pruning |
| 5–6 | Quantization (I & II) | Uniform/non-uniform quantization, PTQ vs. QAT, per-channel/group scaling, integer GEMMs | FP8 training |
| 7–9 | NAS (I & II) & Knowledge Distillation | Supernets, hardware-aware search, teacher–student distillation | Knowledge distillation |
| 10–11 | MCUNet & TinyEngine | Extreme edge/microcontroller inference (optional for LLM focus) | — |
| 12–13 | Transformers, LLM Quantization & Deployment | Activation outliers, SmoothQuant, AWQ, W4A16 decode speedups, serving engines | PagedAttention, Speculative decoding |
| 14 | LLM Post-Training | Efficient fine-tuning, alignment, and post-training systems | LoRA, RLHF & GRPO |
| 15 | Long-Context LLMs | KV-cache scaling, attention sinks / StreamingLLM, sparse attention, KV compression | Lost in the Middle, GQA |
| 16–18 | Vision Transformers & Diffusion Models (I & II) | Token merging, caching, low-step/distilled diffusion inference | — |
| 19, 22 | Distributed Training (I & II) | Data, tensor, pipeline parallelism, gradient compression, communication overlap | Parallelism |
Core ideas worth internalizing
Section titled “Core ideas worth internalizing”Limitations & open questions
Section titled “Limitations & open questions”- Perplexity vs. reasoning fidelity. Classic compression lectures often validate on ImageNet or WikiText perplexity; for 2026 reasoning models and multi-turn agents, quantization errors can accumulate silently across long chains of thought and tool calls—always check task-level accuracy, not just perplexity.
- Hardware generation shifts. FP8 and FP4 native tensor-core support on Hopper/Blackwell GPUs changes the optimal precision frontier compared to older INT8/INT4 integer-only recipes.
Connections
Section titled “Connections”- Build-from-scratch companion: Stanford CS336 covers pretraining, Triton FlashAttention, and scaling laws; MIT 6.5940 goes deepest on compression, quantization, and deployment.
- Frontier talks companion: Stanford CS25: Transformers United V6 (especially Charles Frye’s May 28 serving talk and Nouamane Tazi’s Apr 23 ultra-scale talk).
- Related site pages: FlashAttention, Context Rot, LLM pruning.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
An 8B-parameter LLM is stored in FP16 (2 bytes/param) vs. INT4 weight-only quantization (0.5 bytes/param plus FP16 scale per 128-weight group). Compute the weight footprint in GB for each, and estimate single-token decode latency on a laptop GPU with 200 GB/s memory bandwidth (ignoring KV cache). Why does weight-only INT4 speed up generation more than prefill?
What a strong answer covers
- FP16 weights: 8 × 10^9 × 2 B = 16 GB. INT4 weights: 8 × 10^9 × 0.5 B = 4 GB, plus (8 × 10^9 / 128) × 2 B ≈ 0.125 GB for scales ≈ 4.125 GB total (~3.9× smaller).
- At 200 GB/s memory bandwidth, reading all weights once per generated token takes 16 / 200 = 80 ms in FP16 vs. 4.125 / 200 ≈ 20.6 ms in INT4 (~3.9× speedup).
- Single-token decode (batch 1) has arithmetic intensity ≈ 1 FLOP/byte, so it is strictly memory-bandwidth-bound; shrinking weight bytes directly cuts latency.
- Prefill processes many tokens at once and is compute-bound; weight-only INT4 still dequantizes to FP16 for GEMM compute, so it saves memory capacity but gives much less speedup in prefill unless activations are also quantized (e.g., W8A8 / FP8).
- Mechanism
Explain the core challenge of post-training quantization for LLMs (activation outliers) and contrast how SmoothQuant and AWQ handle it without full retraining.
What a strong answer covers
- Large Transformers develop systematic outlier channels in activations whose magnitude is 10–100× larger than typical channels; naive uniform quantization wastes almost all quantization bins on outliers and destroys accuracy.
- SmoothQuant (W8A8) mathematically migrates quantization difficulty from activations to weights via a per-channel scaling factor s: Y = (X · diag(s)^−1)(diag(s) · W), making both X and W easier to quantize to INT8.
- AWQ (Activation-aware Weight Quantization, W4A16) observes that only ~1% of salient weight channels—identified by activation magnitude, not weight magnitude—dominate error; scaling those salient channels up before INT4 rounding protects them without mixed-precision hardware overhead.
- Both exploit scale invariance of linear layers so the transformation folds cleanly into adjacent LayerNorm/RMSNorm or projection weights at zero inference-overhead cost.
- What if…
MIT 6.5940 separates unstructured pruning, N:M semi-structured sparsity (e.g., 2:4), and structured channel/head pruning. Compare what happens to parameter count, actual wall-clock GPU speedup, and accuracy drop across the three regimes.
What a strong answer covers
- Unstructured pruning removes individual small weights and achieves the highest compression ratio before accuracy collapses, but irregular sparsity causes poor memory coalescing and rarely gives real GPU speedup below ~90% sparsity.
- N:M semi-structured sparsity (such as NVIDIA 2:4) enforces exactly 2 zeros per 4 contiguous weights, matching tensor-core sparse hardware for near-2× compute speedup with modest accuracy loss after light recovery fine-tuning.
- Structured pruning drops whole heads, neurons, or layers, giving immediate dense-kernel speedup on any hardware without special sparse support, but suffers steeper accuracy degradation at the same sparsity ratio.
- Always verify speedups by measuring real latency and throughput, not theoretical MAC/FLOP reductions.
- Connect
How does MIT 6.5940 (Fall 2026) complement Stanford CS336? Map four topics where the two courses overlap and identify three areas where 6.5940 goes much deeper than CS336.
What a strong answer covers
- Overlaps: GPU memory hierarchy & arithmetic intensity, Transformer/LLM architecture and serving, long-context KV-cache bottlenecks, and distributed training (data/model/pipeline parallelism).
- Where 6.5940 goes deeper: pruning & sparsity (2 full lectures + lab), quantization theory & LLM quantization (3 lectures + lab, including AWQ/SmoothQuant), neural architecture search & edge/on-device deployment (MCUNet, TinyEngine, laptop LLM lab), plus vision/diffusion model acceleration.
- Where CS336 goes deeper: pretraining data pipelines (Common Crawl filtering), Chinchilla scaling-law experiments, Triton FlashAttention kernel implementation, and RLVR post-training.
- Together they cover both sides of LLM systems: training a frontier model from scratch (CS336) and compressing/serving it under tight memory and latency budgets (6.5940).
- Design
You need to deploy a 14B reasoning model on a single 24 GB GPU serving 64K-context agent trajectories. Using the toolbox from MIT 6.5940 Lectures 12–15, budget memory between weights and KV cache, pick a compression plan, and list two failure modes you must evaluate before shipping.
What a strong answer covers
- Weight budget: INT4 (AWQ) shrinks 14B weights from ~28 GB (FP16) to ~7.5 GB, leaving ~14–15 GB for KV cache and activations (impossible in FP16 on 24 GB).
- KV-cache budget: compute 2 × n_layers × n_kv_heads × d_head × L × bytes_per_elem; at 64K tokens in FP16 this can still exceed 10 GB depending on GQA ratio, so add KV-cache quantization (FP8/INT4) or sparse/streaming KV eviction.
- Failure mode 1: long-context needle/evidence loss—aggressive KV eviction can silently drop early tool outputs or citations in agent loops even when perplexity looks flat.
- Failure mode 2: reasoning/coding degradation under INT4—evaluate on multi-step math/tool-use accuracy, not just WikiText perplexity, because subtle logit drift compounds over long rollouts.