Language Models from Scratch
- 34Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is the primary reason for teaching a course on building language models from scratch?
Researchers are becoming disconnected from the underlying technology; abstractions are leaky, and fundamental understanding is needed for innovation.
Or swipe the card
34 cards
What is the primary reason for teaching a course on building language models from scratch?
Researchers are becoming disconnected from the underlying technology; abstractions are leaky, and fundamental understanding is needed for innovation.
According to the lecture, what are the three types of knowledge taught in the course?
Mechanics (how things work), Mindset (squeezing hardware performance, taking scaling seriously), and Intuitions (which data and modeling decisions lead to good models).
What is the correct interpretation of the 'bitter lesson' as presented in the lecture?
Algorithms at scale matter; efficiency is crucial because at large scale, algorithmic improvements compound significantly more than scale alone.
Name at least four key historical milestones in language model development mentioned in the lecture.
Shannon's entropy estimation, Google's 5-gram models (2007), Bengio's neural language model (2003), seq2seq models, Adam optimizer, attention mechanism, Transformer (2017), mixture of experts, and model parallelism research.
What are the three levels of openness in language models described in the lecture?
Closed models (API only), open-weight models (weights released but no data details), and open-source models (weights and data available, full transparency).
What is the workload comparison given for the first assignment?
The first assignment was approximately the same amount of work as all five assignments from CS 224N plus the final project.
What is the course's stance on using AI tools like Copilot for assignments?
Use them judiciously and at your own risk; they can take away from learning if they solve the problem entirely.
What is the overarching question the course aims to answer?
What is the best model one can build given a certain compute and data budget?
List the five units (pillars) of the course.
Basics, Systems, Scaling Laws, Data, Alignment.
What components are implemented in the 'Basics' unit?
BPE tokenizer, transformer architecture (with modern improvements: SwiGLU, RoPE, RMS Norm, GQA, etc.), cross-entropy loss, AdamW optimizer, and training loop.
What is the key constraint in the 'Basics' assignment?
Students cannot use pre-built transformer implementations from PyTorch; only a small list of basic functions is allowed.
What are the three sub-topics in the 'Systems' unit?
Kernels, Parallelism, and Inference.
What is the main bottleneck in GPU computation according to the lecture?
Data movement between memory (warehouse) and compute (factory).
Which tool is used in the course to implement custom GPU kernels?
Triton (developed by OpenAI).
What are the two phases of inference in language models?
Prefill (process the entire prompt at once, compute-bound) and Decode (generate tokens autoregressively, memory-bound).
What is speculative decoding?
A technique where a cheaper model generates multiple candidate tokens, and the full model accepts or rejects them in parallel, speeding up inference.
What is the 'Chinchilla optimal' rule of thumb?
For a model of size N parameters, train on 20N tokens.
What is the goal of Assignment 3 (Scaling Laws)?
Given a flops budget, train small models to gather data, fit a scaling law, and predict optimal hyperparameters (e.g., model size) at a larger scale.
Why does the scaling laws assignment have a leaderboard?
To minimize loss given a flops budget; it simulates the real-world challenge of allocating compute wisely.
What are the main steps in data curation for language model training?
Crawling, extraction (HTML to text), filtering, deduplication, and tokenization.
What evaluation metrics are mentioned for language models?
Perplexity, standardized benchmarks (MMLU), instruction following evaluation, and evaluation of full systems (e.g., agentic systems).
What is the purpose of alignment?
To make a base model (next-token predictor) useful by teaching instruction following, style control, and safety (refusing harmful requests).
What are the two main phases of alignment discussed?
Supervised fine-tuning (SFT) on prompt-response pairs, and learning from feedback (RLHF or alternatives like DPO, GRPO).
Name two algorithms for learning from feedback mentioned in the lecture.
DPO (Direct Preference Optimization) and GRPO (Group Relative Preference Optimization).
What is the difference between preference data and verifier data in alignment?
Preference data consists of human comparisons between two responses; verifier data uses a formal or learned verifier (e.g., for math or code) to judge response correctness.
What are the four types of tokenization compared in the lecture?
Character-based, byte-based, word-based, and BPE (byte pair encoding).
What is a major disadvantage of character-based tokenization?
Poor compression ratio (about 1.5 bytes per token) and large vocabulary for Unicode (up to 1.1 million code points), leading to sparse usage.
What is a major disadvantage of byte-based tokenization?
Longer sequences (compression ratio = 1 byte per token), which is computationally inefficient for attention (quadratic complexity).
What is the main problem with word-based tokenization?
Unbounded vocabulary; unseen words become unknown tokens, causing issues with perplexity and generation.
What is the core algorithm of Byte Pair Encoding (BPE)?
Initialize vocabulary with all bytes (0-255), then iteratively merge the most frequent adjacent pair of tokens into a new token, updating the vocabulary and corpus.
How does BPE handle tokenization of new text?
Encode by replaying the learned merges in order on the byte sequence; decode by looking up tokens in the vocabulary mapping (token to bytes).
What pre-tokenization step does GPT-2 use?
It splits the input text into segments using a regular expression (e.g., handling spaces, punctuation) before applying BPE on each segment.
What is the compression ratio of the GPT-2 tokenizer?
About 1.6 bytes per token.
Why does the lecture hope that tokenization lectures will become obsolete?
Because future architectures may directly process raw bytes, eliminating the need for tokenization.

Ask anything
We've read this whole study set, so questions about it get the best answers.