Talkshelf
Back to videos

Let's build GPT: from scratch, in code

Andrej Karpathy

1:56:20 · 2023

YouTube

Study materials

Materials for this selected video are in preparation. Watch the video and use the public learning guide while they are being prepared.

Slides are a PPT outline, not a finished slide deck.

Overview

Andrej Karpathy builds a GPT from scratch in code, following Attention Is All You Need and GPT-2/3, in about two hours using PyTorch. He connects it to ChatGPT and assumes familiarity with his earlier makemore videos.

Why HN discusses it

It is the go-to recommendation for learning how transformers and LLMs actually work, praised for its clarity and Karpathy's teaching.

Before you watch

Familiarity with Python, tensors, PyTorch and earlier makemore lessons is recommended. Choose this session when you can already train and inspect a small neural network.

A way to study this video

Implement one component at a time and check tensor shapes before continuing. Explain the role of attention using your own code, then connect the training objective back to the character-level model.

Follow the Andrej Karpathy learning guide · Original Zero to Hero course

LLMs & generative AI · Machine learning & deep learning

HN comments

20 collected comments

Newest first

jiggawattsReference

In discussion: AI's $600B Question

That's... my point. You're agreeing with me. Siri and Alexa are bad . Very, very bad. They pretend to understand spoken English, but they don't , because they're just a huge set of hard-coded rules written out one-at-a-time by enormous numbers of very expensive developers. This is the 1990s approach to AI: Fuzzy logic, heuristics, solvers, dynamic programming, etc... That approach has been thoroughly blown out of the…

villedespommesStrong recommendation

In discussion: Implementing a ChatGPT-like LLM from scratch, step by step

+1, Andrey is an amazing educator! I'd also recommend his [VIDEO] and checking out his github repos. MinGPT, for example, implements a small gpt model that's compatible with HF API, whereas more modern nanoGPT shows how to use newer features such as flash attention. The quality of every video, every blog post is just so high.

Showing 5 of 20 comments