What it does
This is the official code for the book "Build a Large Language Model (From Scratch)". A large language model (LLM) is the kind of AI behind chatbots like ChatGPT.
Chapter by chapter, you write a small but working model: preparing text, building the parts that let it pay attention to words, training it, and then teaching it to classify text and follow instructions. The author says the method mirrors how the big models are made.
The code is designed to run on an ordinary laptop. There is also an optional companion video course and a follow-up book on reasoning models.
Who it's for
People with solid Python skills who want to really understand how AI chat models work inside.
Can I use it without coding?
Developers only. The author lists strong Python programming as the main prerequisite; the code runs as notebooks. New to this? Start here.
Can I run it?
- Cost
- FreeNothing to pay or sign up for.
- Computer
- An ordinary computer is fine
- Privacy
- Runs on your own device: your data stays with you
- API key
- Not needed
Try it
- Download a copy of the repository as a ZIP file.
- Follow the setup guide in the repository to install Python and its packages.
- Work through the chapter notebooks alongside the book.
Using Claude Code, Cursor or another AI coding assistant? Paste the prompt and it will walk you through the setup.New to this?
Before you install
- Only download from the official GitHub page. Copies with similar names exist for many popular projects.
- No standard license listed. Check the GitHub page before using it for business.
- More on staying safe
Where people are talking about it
- Gemma 3 270M re-implemented in pure PyTorch for local tinkeringHacker News · Aug 2025
- Implementing a ChatGPT-like LLM from scratch, step by stepHacker News · Jan 2024