Understanding LLMs
From the maths underneath to building with models, and checking the code they write.
21 posts · about 172 min of reading
Who it's for: Engineers who use LLMs and want to know what is going on inside, one step at a time.
Stage 1 The maths underneath
AI from the ground up, part 0: a maths cheat sheet
The vectors, dot products and matrices every later post leans on.
AI from the ground up, part 1: the maths behind an LLM
The four bits of maths an LLM runs: vectors, matrices, softmax, gradients.
AI from the ground up, part 2: probability, the language of machine learning
Why every answer is a probability, and what temperature and top-p change.
AI from the ground up, part 3: what GPUs actually do
Why AI runs on GPUs, and why memory, not compute, is usually the limit.
Stage 2 How a model is made
What model weights are: from one neuron to a 19 GB file
What a weight is, and how 30 billion of them become a 19 GB file.
How an LLM is built, part 1: the plan, the data and the design
The nine stages from raw text to model; then data, tokenizer and design.
How an LLM is built, part 2: pre-training, months of guessing the next word
Pre-training is guessing the next word, trillions of times, across thousands of GPUs.
How an LLM is built, part 3: from base model to assistant
How fine-tuning and reinforcement learning turn a base model into an assistant.
AI from the ground up, part 4: what is a frontier model?
What "frontier model" means, and what it shouldn't mean when you choose one.
Stage 3 Using models well
AI from the ground up, part 5: using models effectively
Decide what success looks like and build a test set first; then choose the model.
AI in practice, part 3: Tokens and tokenomics
What a token is, why context windows end, and how the bill is counted.
Ollama or Colibri? A beginner's comparison on two of my machines
Two ways to run a model on your own machine, and which to try first.
Can a local 30B model write my blog? I fact-checked it
Where a local 30B model helps a writer, and where it gets facts wrong.
Stage 4 Building with models
AI in practice, part 1: Choosing the right framework
What each layer of the AI stack does, from PyTorch to LangChain.
AI in practice, part 4: From RAG to tools and agents
How a model goes from answering to acting: function calls and the agent loop.
AI in practice, part 5: MCP, the Model Context Protocol
One standard plug between models and tools, and the security rules that come with it.
Stage 5 Checking what a model wrote
Colibri on my desk: a 30B model writes a network scanner, slowly
What a local model's code got wrong, and what memory did to its speed.
Testing code an AI wrote, part 1: read it before you run it
Read generated code first: find every call that can delete a file.
Testing code an AI wrote, part 2: it installs fine, but its own tests fail
Installing isn't working: its own tests couldn't even start.
Testing code an AI wrote, part 3: one fix away from disaster
A one-line fix can delete the last copy of a file; tests must catch it.
Testing code an AI wrote, part 4: the web UI's front door
A local web page needs a real Host check, or DNS rebinding gets in.
Older AI and data posts, from TF-IDF to RAG, are on the AI reading map. AI on this blog: a reading map
