LLM Pre-Training for Dummies
WHAT YOU'LL LEARNThis book teaches you how to pre-train a GPT-2 language model from scratch on a single GPU. No abstractions, no hand-waving. You'll understand every line of code and every design decision.By the end, you'll know:How tokenization converts text to numbers using Byte Pair EncodingHow embeddings turn token IDs into learnable vector representationsHow self-attention lets tokens communicate with each otherWhy we scale dot products and apply causal maskingHow multi-head attention runs parallel attention operationsHow transformer blocks combine attention, feed-forward networks, and residual connectionsHow the training loop works: forward pass, cross-entropy loss, backpropagation, AdamWHow to make training efficient with mixed precision, gradient accumulation, and Flash AttentionHow to prepare the OpenWebText dataset and run a real training jobHow to monitor loss curves, save checkpoints, and generate textThis is the book version of Andrej Karpathy's nanoGPT. Same philosophy: minimal code, maximum understanding. Everything runs on a single RTX 3090 or similar 24GB GPU.No fine-tuning. No RLHF. Just pre-training, done right.WHO THIS IS FORYou have basic PyTorch knowledge (tensors). You want to understand how language models actually work at the implementation level. You're not afraid of matrix multiplications.TABLE OF CONTENTSPrologue: Where Intelligence BeginsChapter 1: From Text to NumbersChapter 2: EmbeddingsChapter 3: AttentionChapter 4: Multi-Head AttentionChapter 5: The Transformer BlockChapter 6: The Training LoopChapter 7: Making It EfficientChapter 8: Training on Real DataAppendix
Get it → elliotarledge.gumroad.com