Summary
Percy Liang opens the third edition of CS336 by arguing why researchers should understand language models at the level of implementation rather than prompting, and what parts of that understanding survive the gap between classroom scale and frontier scale. The bulk of the lecture is a walkthrough of the five course units — basics, systems, scaling laws, data, and alignment — each mapped to one assignment. The final third starts the first technical unit, tokenization, building up from character- and byte-level schemes to byte-pair encoding. The through-line for the whole course is efficiency: getting the best model out of a fixed compute and data budget.
Key Takeaways
- Results at small scale do not always transfer: the share of FLOPs spent in MLP layers rises from roughly 44% at small scale to about 80% at 175B, and few-shot capabilities only appear past a critical scale, so attention-level optimizations validated on small models may not pay off at the frontier.
- The course splits transferable knowledge into mechanics (how a transformer or model parallelism works), mindset (profile and benchmark everything, take scaling seriously), and intuitions (which data and modeling choices work). Mechanics and mindset transfer; intuitions largely do not, which is why some design choices are only justified by experiment — the SwiGLU paper famously attributes its gains to “divine benevolence.”
- The bitter lesson is commonly misread as “scale is all that matters.” The correct reading is that algorithms which scale are what matter: accuracy is roughly efficiency times resources, and efficiency matters more as budgets grow, since a 5% gain on a $100M run is significant. See Rich Sutton - The Bitter Lesson and General methods that keep scaling with computation beat human-knowledge methods in the long run.
- Frontier models are closed — the GPT-4 report explicitly declines to describe how the model was built — so the course depends on the open ecosystem (Llama, Mistral, Qwen, DeepSeek) and on fully open efforts such as AI2, NVIDIA, and the Marin project that release data and code alongside weights.
- Assignments: A1 implements BPE, the transformer, loss, and optimizer, with perplexity leaderboards on TinyStories and OpenWebText; A2 covers Triton kernels and parallelism; A3 fits scaling laws against a cached training API that returns a loss for a submitted config; A4 filters and deduplicates a raw web crawl; A5 covers alignment with DPO and GRPO.
- A tokenizer’s compression ratio is bytes per token, and raising it shortens sequences, which matters because attention is quadratic in sequence length. Character-level tokenization wastes a 150k-entry Unicode vocabulary on rare characters; byte-level gives a 256-entry vocabulary but a compression ratio of 1; word-level gives an unbounded vocabulary and needs an UNK token.
- BPE starts from a byte sequence where every byte is a token, repeatedly finds the most frequent adjacent pair, and merges it into a new token id starting at 256. It originated in data compression, moved to neural machine translation, and was first used for LLMs in GPT-2. Common sequences become single tokens and rare ones fall back to smaller units, so nothing is out of vocabulary.
- Tokenizers are awkward in practice: a word and the same word with a leading space are unrelated token ids, digit grouping is often unpredictable, and multilingual vocabularies now run to 100k–200k tokens, trading compression against sparsity.
- Any end-to-end replacement for tokenization would still need the two properties a tokenizer provides — abstraction above raw bytes, since individual bytes are low signal-to-noise, and variable-size chunks so that compute is spent adaptively.
Extracted Notes
- None yet.