← Back to A Learning Journey: Zero to Hero

<aside> 🎯

Build a small language model — and actually understand it →

My plain-English walk-through, live on the web, in three parts: the ideas with no code, a tiny GPT built from scratch, and a real open model fine-tuned into a useful expert. No Python required.

</aside>

Last reviewed: 3 October 2026

I wanted to understand language models by building one. small-model-lab is that project, done in the open: a tiny GPT trained from nothing on my Mac, then a small model fine-tuned to do a useful job.

It is learn-by-doing: annotated notebooks, live loss curves, every modeling choice written down, and no magic numbers. The walk-through gives the idea first, then the code, then a plain-English translation of every block.

Three parts

Part 0 · Concepts: the optional primer

How a language model works, in plain English with no code: what a model is, how text becomes numbers, and what "learning" means, with a dozen diagrams drawn from the lab's real model, including a measured attention head and real next-word probabilities.

Read Part 0 →

Part 1 · Pre-training: start here

Build and train a tiny GPT one piece at a time: tokens, attention, the training loop, y = Wx + b, and sampling. The output is throwaway quality by design; the point is to see every moving part.

Read Part 1 →

Part 2 · Post-training: the payoff

Take a pretrained open model and fine-tune/distill it into TrialScout, a small expert that turns a clinical-trial record into a structured, investor-relevant readout and runs locally, for free. On held-out trials it scores higher than the frontier model that taught it when that model is handed only the schema: an overall structured score of 0.932 against 0.897, where always guessing the commonest answer scores 0.476. The win comes from the conventions the teacher was given; when the teacher has them, the student tops out near it. On rare drug classes the frontier model is still far better.

Read Part 2 →

What you'll come away understanding