Last checked
Best course to build an LLM from scratch, compared
By Sandip Maity, Applied AI Engineer
The short answer
For free video where the code is written live, Andrej Karpathy's Neural Networks: Zero to Hero (about 14.5 hours, from micrograd to GPT and its tokenizer). For a book you can work through at your own pace, Sebastian Raschka's Build a Large Language Model (From Scratch), 368 pages from Manning. For the most depth, Stanford CS336, with free recordings and hard assignments, if you can pay for GPU time. Inference Academy's Build an LLM from Scratch, which we make, is interactive text: 17 lessons from a BPE tokenizer to RoPE, GQA and LoRA, ending in a capstone, and it leads into our inference courses.
Disclosure: Inference Academy wrote this page, and options marked “Ours” are our own, so this is not an independent review. There are no affiliate links. Every fact about another provider was read on that provider’s own page on 25 November 2026, and each row links its source. Prices are what a visitor in the United States saw. Our own numbers are counted from the site’s lessons when the page is built.
Side by side
Checked 25 November 2026. Prices and syllabi change, so confirm on each source before you pay.
- Neural Networks: Zero to HeroAndrej Karpathy
- Price
- Free.
- What it covers
- 8 videos listed, about 14.5 hours: micrograd and backpropagation, makemore (bigram, MLP, BatchNorm, manual backprop, WaveNet), building GPT from the paper, and the GPT tokenizer.
- Format
- Long video lectures where the code is written live, on YouTube.
- Hands-on
- You code along and run everything yourself; a Discord for questions.
- Last updated
- No date shown; the syllabus is marked ongoing
- Source
- karpathy.ai/zero-to-hero
- Build a Large Language Model (From Scratch)Sebastian Raschka, Manning
- Price
- eBook $54.99, print with eBook $59.99 list price; 35% off on 25 November 2026.
- What it covers
- A GPT-style model you can run on a laptop: text data, attention, the model, pretraining on unlabelled data, then fine-tuning for classification and for following instructions.
- Format
- A 368-page book with source code on GitHub and a chapter-by-chapter live-coding video playlist.
- Hands-on
- Runnable code for every chapter.
- Last updated
- Published September 2024
- Source
- manning.com book page
- CS336 Language Modeling from ScratchStanford (Hashimoto and Liang)
- Price
- Free to follow: lecture recordings are on YouTube and the assignments are public. You pay for your own GPU time.
- What it covers
- Building a language model end to end: tokenizer, transformer, training, GPUs and TPUs, kernels and Triton, parallelism, scaling laws, inference, data and alignment.
- Format
- University lectures, Spring 2026, with five large assignments and little scaffolding.
- Hands-on
- Assignment 2 has you profile the model and write FlashAttention2 in Triton; the page lists cloud GPU options for self-study.
- Last updated
- Spring 2026 term
- Source
- stanford-cs336.github.io
- Build an LLM from ScratchInference Academy (ours)Ours
- Price
- Free lessons and tools; Pro is $25 a year or $75 once for life (₹1,999 or ₹5,999 in India). One payment that never renews by itself, a 7-day refund, and Pro unlocks every course.
- What it covers
- 17 lessons (5 free): a byte-pair-encoding tokenizer, embeddings and batches, attention from first principles, the GPT block with exact parameter counts, autograd and a training loop, sampling and the KV cache, RoPE, RMSNorm, SwiGLU and GQA, LoRA fine-tuning, a data pipeline, mixed precision and a capstone.
- Format
- Self-paced interactive text lessons with diagrams and quizzes. No videos.
- Hands-on
- 1 lab lessons, including training a tiny GPT, plus a capstone that trains and ships your own small GPT.
- Last updated
- Lessons verified November 2026
Our verdict on each option
Andrej Karpathy: Neural Networks: Zero to Hero
Choose it if you learn by watching an expert code, and want it free.
Watch out: Long videos with no quizzes or checkpoints; modern upgrades such as RoPE and GQA are not in the listed videos.
Sebastian Raschka, Manning: Build a Large Language Model (From Scratch)
Choose it for a careful, complete book with code, from data to instruction fine-tuning.
Watch out: A book, so you pace yourself; prices change with Manning's sales.
Stanford (Hashimoto and Liang): CS336 Language Modeling from Scratch
Choose it for the deepest treatment: systems, scaling, data and alignment, with demanding assignments.
Watch out: Plan for many hours a week and your own GPU budget.
Inference Academy: Build an LLM from ScratchOurs
Choose it for short interactive lessons with quizzes that go from a tokenizer to modern upgrades, then on to serving what you built.
Watch out: Text, not video, and smaller than CS336 in scope.
How we compared
- Completeness. Tokenizer, attention, training, sampling and the KV cache, and modern parts such as RoPE, RMSNorm and GQA.
- Format. Video, book, university course or interactive lessons.
- Cost. The price, and the GPU time you will need.
- Where it leads. Whether it connects to fine-tuning and serving afterwards.
Each outside fact was read on the provider’s own page on 25 November 2026 and is linked in the Source column. Anything we could not confirm there, such as an unpublished price, is said to be missing rather than guessed. Ratings and testimonials are left out. If a provider sees a mistake, tell us and we will correct it.
Questions
What is the best course to build an LLM from scratch?
Karpathy's Zero to Hero if you want free video; Raschka's Build a Large Language Model (From Scratch) if you want a book; Stanford CS336 for the most depth; Inference Academy's Build an LLM from Scratch (17 lessons, 5 free) for interactive lessons that lead into inference. Inference Academy wrote this page and one option is ours, so weigh our view with that in mind.
Is Karpathy's Zero to Hero free?
Yes. On 25 November 2026 its page listed 8 videos, about 14.5 hours in all, from micrograd to building GPT and its tokenizer, free on YouTube.
How much does Build a Large Language Model (From Scratch) cost?
On 25 November 2026 Manning listed the eBook at $54.99 and print with eBook at $59.99, with 35% off that day. The book's code is free on GitHub.
Can I build an LLM from scratch without a GPU?
A tiny one, yes: small GPTs train on a laptop CPU or a free Colab GPU. Larger runs, like CS336's assignments, need rented GPUs.
Who wrote this comparison?
Inference Academy wrote it, and one option is ours. Every outside fact was read on its source page on 25 November 2026.
More comparisons
- Best LLM inference engineering course in 2026, comparedEight courses and resources side by side, from two-hour video courses to a live cohort and a university class.
- Best vLLM course: where to learn vLLM in 2026Seven ways to learn vLLM, from a 98-minute video course to the official docs, with what each covers.
- Best course to learn CUDA and Triton for LLM inferenceSix ways to learn GPU kernels for inference, from free lectures to a sequenced course on a free Colab GPU.
- Free LLM inference engineering resources, comparedNine free resources, what each one teaches, and an order to use them in.
- Inference Academy vs Fanout for learning inference engineeringPrice, size, format and labs side by side, with the cases where Fanout is the better choice.
- Inference Academy vs systemdesign.academy for inference engineeringTwo self-paced text courses: first-principles breadth against labs on a rented RTX 4090.