Build a Small LLM
Build a small LLM from scratch. Dataset, tokenizer, GPT architecture, training, and generation.
Learning path
Work through each subtopic in order. Click any file below to open its lesson. Track your progress with the checkbox at the bottom.
Subtopics
Each subtopic includes a concise explanation, code examples, and references.
Book Dataset
Book reader + dataset panel.
Text Extraction
Raw-book-to-text pipeline.
Text Cleaning
Cleaning preview.
Tokenizer
Tokenizer playground.
Training Sequences
Sliding context window.
Embeddings
Token embedding flow.
Transformer
Small GPT architecture builder.
Training Loop
Live training dashboard.
Text Generation
Interactive local-model chat.
Model Inspection
Layer/parameter explorer.