Transformers and LLMs from Scratch
AIE-2044 credits · 80h required · after AIE-203
The flagship of Block II, and the largest course in the programme. It ends with a working GPT you can explain line by line — from the byte-pair tokeniser you wrote through to the sampler — which is the single most legible artifact this degree produces. The thing being bought is not the ability to build one; nanoGPT already exists. It is that after this, every architectural claim in a paper or a vendor's release notes is checkable against something you have implemented rather than taken on trust.
The lab. 1 Percent More Fluent, for the half of this course nobody expects. It carries text in several languages, and the same sentence costs wildly different numbers of tokens depending on which — a real, measurable cost and latency problem sitting inside a product you already run. The tokeniser module is not an academic exercise there; it is the explanation for a bill.
By the end you can
- Implement multi-head self-attention from scratch, without reference
- Train a small GPT end to end, from tokeniser to sampling
- Explain every architectural choice in a modern decoder and what it is buying
- Reproduce a published result and account for the gap where you fail to
What this builds
- Transformer architecture0/17 demonstrated
- Text representation · supporting0/4 demonstrated
Next assessment. Byte-pair encoding from scratch — 180 min, tier 1. Machine-checkable, so you can attempt it before reading anything and find out whether you need to.
0/20 assessed items demonstrated · 0/17 read or watched. The second number is how you close a gap; only the first is evidence that it closed.
0 of 20 demonstrated · 0/17 read
0m of 80h
M1 · Tokenisation, which is where the bill comes from
0/5 · 12hlecture · 3h · tier 0 self-marked
Neural Networks: Zero to Hero — Andrej Karpathy
reading · 2h 45m · tier 0 self-marked
assignment · 3h · tier 1 machine-verified
assignment · 3h · tier 2 panel-assessed
retention · 15m · tier 1 machine-verified
M2 · Attention, implemented
0/7 · 14hreading · 1h 45m · tier 0 self-marked
reading · 2h · tier 0 self-marked
lecture · 3h · tier 0 self-marked
Let's build GPT: from scratch, in code, spelled out — Andrej Karpathy
assignment · 3h · tier 1 machine-verified
assignment · 2h 30m · tier 2 panel-assessed
lecture · 1h 30m · tier 0 self-marked
Stanford CS224N: Natural Language Processing with Deep Learning — Stanford Online
retention · 15m · tier 1 machine-verified
M3 · A GPT you can explain line by line
0/6 · 15hlecture · 3h · tier 0 self-marked
Let's build GPT: from scratch, in code, spelled out — Andrej Karpathy
reading · 2h 45m · tier 0 self-marked
assignment · 3h · tier 1 machine-verified
assignment · 3h · tier 2 panel-assessed
reading · 3h · tier 0 self-marked
retention · 15m · tier 1 machine-verified
M4 · What changed since 2017
0/7 · 13hlecture · 2h 30m · tier 0 self-marked
Stanford CS25 - Transformers United — Stanford Online
reading · 1h 45m · tier 0 self-marked
FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
assignment · 3h · tier 2 panel-assessed
lecture · 2h 45m · tier 0 self-marked
Stanford CS336 Language Modeling from Scratch I 2025 — Stanford Online
reading · 1h 30m · tier 0 self-marked
Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity
assignment · 1h 15m · tier 1 machine-verified
retention · 15m · tier 1 machine-verified
M5 · Reproduce a published result
0/6 · 14hlecture · 3h · tier 0 self-marked
Let's reproduce GPT-2 (124M) — Andrej Karpathy
reading · 2h 45m · tier 0 self-marked
project · 3h · tier 2 panel-assessed
project · 2h 30m · tier 2 panel-assessed
reading · 2h 30m · tier 0 self-marked
retention · 15m · tier 1 machine-verified
M6 · Publish, and defend
0/6 · 12hproject · 3h · tier 3 artifact
project · 3h · tier 3 artifact
lecture · 2h 45m · tier 0 self-marked
CMU Advanced NLP Fall 2024 — Graham Neubig
assignment · 2h · tier 2 panel-assessed
defense · 1h · tier 4 defended
retention · 15m · tier 1 machine-verified