LLM Foundations
Build the tokenizer-to-cached-generation path, test every causal and state boundary, and connect model quality claims to evaluation and arithmetic.
5 sections · 35 units · about 135 hours
- Text as bytes: Unicode, encodings and normalization3h
- Byte-level BPE: training, merges and tie-breaking6h
- Tokenizer design choices: vocabulary size, Unigram and special tokens3h
- A tokenizer you can trust: round trips, identity and streaming6h
- From documents to training examples: packing and loss masks4h
- Provenance, deduplication and contamination4h
- Filtering, mixtures and deterministic shards5h
- Embeddings, positions and the vocabulary axis3h
- Scaled dot-product attention from scratch5h
- Multi-head attention: split, merge and gradients4h
- MQA and GQA: sharing keys and values4h
- RoPE: positions as rotations4h
- The modern decoder block: residuals, RMSNorm and SwiGLU6h
- Assembling and verifying a decoder6h
- The next-token objective: shifts, masks and perplexity4h
- Feeding the model: batches, initialization and first steps3h
- AdamW, schedules and the global token batch4h
- Keeping training numerically healthy3h
- Checkpoints that really resume4h
- Decoding policies: from greedy to nucleus sampling4h
- Stopping rules and reproducible generation3h
Final project: Tokenizer-to-Cached-Generation Evidence Pack
Keep one small corpus, tokenizer identity, model configuration and evaluation manifest across three artifacts. The result proves the whole causal-language-model mechanism while leaving large-scale training and serving to their dedicated tracks.
- Tokenizer and corpus audit pack - deterministic byte-safe BPE, serialized identity, adversarial properties, split-before-pack pipeline, provenance manifest, deduplication report, contamination probe and reproducible restart
- Tiny decoder stack - blank-file embeddings, RoPE, RMSNorm, MHA plus GQA or MQA, SwiGLU, causal loss, AdamW, complete checkpoint state, four decoding policies and differential, causality, mask and resume tests
- Evaluation, arithmetic and cached-generation dossier - versioned task and parser, raw outputs, slices and uncertainty, evaluator failure case, parameter, FLOP and memory worksheet, full-prefix cache equivalence and separate prefill and decode measurements
How it's graded · about 8 to 12 hours
One identity across artifacts
Pass: All three artifacts use one tokenizer hash, one model config and one evaluation manifest.
Great: One command checks the hashes and fails if any artifact uses a different one.
Tokenizer and corpus audit pack
Pass: The section 1 mini-project meets Pass on every criterion.
Great: It meets Strong on at least half its criteria, including reproducibility.
Tiny decoder stack
Pass: The section 2 and 3 mini-projects meet Pass, and their CS336 tests and your own tests pass in one run.
Great: Resume is exact on CPU, and the attention oracle compares gradients in float64.
Evaluation, arithmetic and cached-generation dossier
Pass: The section 4 and 5 mini-projects meet Pass.
Great: Every estimate sits next to a measurement, and cache equivalence covers MHA, GQA and MQA.
Rebuild from a clean clone
Pass: A README lists the commands that rebuild each artifact.
Great: One script rebuilds every reported number from a fresh clone on a CPU in under an hour.
Honest limits
Pass: The dossier states what the tiny model and small corpus cannot show.
Great: Each limit names the later track that addresses it.