EDGE FDE
IntermediateHow an LLM is built
After this course you can explain, in plain English, how an LLM learns, reads text, trains, and gets cheaper. You will also have small pieces of code you can run.
We walk seven public repos by Andrej Karpathy, in the order Hao Hoang recommends. Each lesson starts with the question it answers, then an everyday picture, then a small example with real numbers, then the code, then what the official repo does at full size.
Inspiration
This course is inspired by a LinkedIn post by Hao Hoang, published 24 November 2026 at 23:20 Europe/London (UTC). Hao screens AI engineer candidates. The gap he sees most is between calling an LLM and knowing how one is built. He pointed to seven free repos by Andrej Karpathy and gave the order to take them in.
The ordering rule is Hao's: each stop answers the question the one before it leaves open. This course follows that rule. The repos, lectures, papers, and numbers come from those primary sources, not from the post alone.
How we will teach
You do not need to be a machine learning person to start. You do need comfortable Python, and a willingness to do a little arithmetic. Each new word is explained before we use it. When we use an everyday comparison, we also say where that picture stops being accurate.
The seven stops
First we learn how a tiny network improves itself.
flowchart LR
S1["1. How a network learns"] --> S2["2. Eight lectures that reach GPT"]
Then we learn what the model actually reads, and what one training loop looks like.
flowchart LR
S1["1. Learning"] --> S2["2. Lectures"]
S2 --> S3["3. Tokens"]
S3 --> S4["4. The training loop"]
Then we look under the Python tools, at today's cost, and at an agent that can run the loop overnight.
flowchart LR
S1["1. Learning"] --> S2["2. Lectures"]
S2 --> S3["3. Tokens"]
S3 --> S4["4. Training loop"]
S4 --> S5["5. Under PyTorch"]
S5 --> S6["6. Cost today"]
S6 --> S7["7. An agent runs the loop"]
What you'll learn
- How one tiny calculator, called a neuron, makes a guess, measures how wrong it is, and turns its knobs to do better.
- How eight lectures take that idea up to a GPT and its tokenizer, and when you are ready to leave the lectures for the small repos.
- How text is broken into tiles called tokens, and how a short GPT-4 wrapper can match tiktoken's tile IDs.
- What a clear training loop looks like, and why nanoGPT is now for reading, not for new training runs.
- What still has to happen when the same trainer is written in plain C and CUDA.
- What a full chat pipeline costs now, including the $48 and $43,000 figures and what they do and do not mean.
- How an agent can edit one training file, train for five minutes, and keep a change only when validation bits per byte improve.
Lessons
Key concepts
- Calling an LLM and knowing how one is built are different skills. The second one is learnable from small, public code.
- Each stop answers the question the previous stop leaves open: learning, the path to a GPT, tokens, the training loop, the work under PyTorch, today's cost, then agents that run the loop.
- A network learns by making a guess, measuring how wrong it is, and taking a small step downhill on that error.
- A tokenizer is a separate trained stage. It maps strings to token IDs and back.
- A training loop is: take a batch, make a guess, measure the error, send the error backward, take a step, and repeat.
- nanoGPT is deprecated in favour of nanochat. Read nanoGPT for clarity. Train with nanochat if you want the current pipeline.
- The $48 and $43,000 figures are explained in the nanochat README and in Karpathy's write-up of the estimate. The current speedrun record is 1.65 hours on 8×H100, as of 14 March 2026.
- Autoresearch keeps a change only when validation bits per byte improves after a fixed five-minute training budget.
Takeaways
- You can work one neuron by hand, then rebuild a tiny engine and check it against published numbers.
- You have a map of the eight Zero to Hero lectures and a clear gate before you move to the tokenizer repo.
- You can train a small tokenizer and say how a GPT-4 wrapper matches tiktoken.
- You can point at the two files that make a readable GPT trainer, and you know which repo to use if you want to train today.
- You can explain what remains when the trainer is written in C and CUDA.
- You can quote the cost figures with their sources, and you know a laptop is enough to learn the pipeline even if you never rent 8×H100.
- You can describe the keep-if-improved agent loop, including the metric it actually uses.