ShelfReading list

ReadAIBook 112024

Build a Large Language Model (From Scratch)

Sebastian Raschka

No magic left once you write tokenization, causal multi-head attention, pretraining, and instruction fine-tuning line by line in PyTorch.

  1. 1Byte-pair encoding and token embedding geometry
  2. 2Causal self-attention and multi-head projections
  3. 3Residual streams, LayerNorm, and GELU feed-forward blocks
  4. 4Pretraining loop, cross-entropy loss, and perplexity
  5. 5Temperature, top-k, and nucleus sampling
  6. 6Loading pretrained weights into a clean architecture
  7. 7Supervised fine-tuning for classification and chat
  8. 8Preference alignment and LLM-as-a-judge evaluation
Build a Large Language Model (From Scratch) by Sebastian Raschka