Home›Library›AI & Data Science

Curated Library

Neural Networks from Scratch to GPT in PyTorch

A code-along series that starts with a tiny autograd engine and builds up, step by step, to character-level language models, a Transformer GPT, a BPE tokenizer and a GPT-2 (124M) reproduction. It covers backpropagation, MLPs, initialization, BatchNorm, convolutional architectures, self-attention and training at scale. It suits programmers who know basic Python and are ready to spend many hours reading and writing PyTorch code.

  • 10 lessons
  • 19h 21m total
  • AI & Data Science
  • English
  • Earns YodaCoins
Lessons byAndrej Karpathy on YouTube

Curated by YodaHut. These lessons are hosted on YouTube and produced by their original creators, who are not affiliated with YodaHut. You still earn YodaCoins, keep your streak and track progress here.

10 lessons19h 21m total
One block per lesson, sized by its length

What You'll Learn

  • Implement a scalar autograd engine and compute gradients by hand through neurons and multi-layer perceptrons
  • Build and train character-level language models: bigram counts, then embeddings plus an MLP, with minibatches, learning-rate tuning and train/val/test splits
  • Diagnose and fix training problems such as bad initial loss, saturated tanh and badly scaled activations and gradients, using Kaiming init and BatchNorm
  • Backpropagate manually through cross-entropy, linear layers, tanh and BatchNorm without calling loss.backward()
  • Extend an MLP into a deeper WaveNet-style hierarchical model using torch.nn-style layers and containers
  • Implement self-attention and a GPT-style Transformer, write a byte-pair-encoding tokenizer, and follow a GPT-2 (124M) reproduction with its training setup

Prerequisites

  • Basic Python programming
  • Vague high-school calculus (derivatives, chain rule)
  • Basic probability helps but is not required

Course Curriculum

10 lessons · 19h 21m

About the Instructor

Andrej Karpathy

YouTube creator

10 lessons here 19h 21m

The lessons in this course were produced by Andrej Karpathy and are published on YouTube. YodaHut selected and sequenced them into this course; we did not make them, and Andrej Karpathy is not affiliated with YodaHut.

Visit the channel on YouTube

More in the Library: AI & Data Science