EDGE FDE
IntermediateHow an LLM is built
After this course you can explain each stage of an LLM, and you can start rebuilding the parts that are usually hidden behind an API call.
Walk seven public repos by Andrej Karpathy, in the order Hao Hoang recommends, and leave able to say how a network learns, how text becomes tokens, what a training loop does, what PyTorch is doing for you, what a full pipeline costs, and how an agent can run the experiments.
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 cited below come from those primary sources, not from the post alone.
What you'll learn
- How a tiny autograd engine turns a forward pass into gradients, and how a small neural net sits on top of it.
- How eight lectures reach a GPT and its tokenizer, starting at a single neuron, and when you are ready to leave the lectures for the small repos.
- How Byte Pair Encoding turns text into token IDs, and how a short GPT-4 wrapper can match tiktoken's IDs.
- What a clear training loop and a small GPT definition look like, and why nanoGPT is now for reading, not for new training runs.
- What a plain C and CUDA training file still has to do once you take PyTorch away.
- 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 GPT, tokens, the training loop, the kernels under PyTorch, today's cost, then agents that run the loop.
- Autograd builds a graph on the forward pass and walks it backward to get gradients.
- A tokenizer is a separate trained stage. It maps strings to token IDs and back.
- A training loop is batch, forward, loss, backward, and an optimizer step, repeated.
- 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 rebuild a tiny autograd 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 BPE 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.