LLMs from scratch
A guide to building a language model from nothing: the ideas, and an implementation in C you write yourself. Switch to Concepts in the header to fold the implementation away and read only the ideas.
Primer
Neural networks from nothing
Optional. For readers new to neural networks: every idea the rest of the guide assumes, with no maths beyond school algebra.
Part 0
Foundations
In C. Ends with: a character-level transformer trained in C, and your experiment harness.
Part 1
A solid baseline
Ends with: a GPT-2-style model you fully understand. Every later chapter is measured against it.
Part 2
The modern architecture
Ends with: a small model with a current open-model design.
Part 3
Training like a lab
Ends with: the capstone pretraining run.
Part 4
Post-training
Ends with: a chat model that visibly learns to reason on arithmetic.
Part 5
Using it
Ends with: your model running in your own C engine, behind a chat interface.