Talks to Watch

Let's build GPT: from scratch, in code, spelled out.

8.2M views · Jan 17, 2023 · 1:56:20 · 14 HN recommenders · 20 mentions · discussed 2023–2025

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 Hacker News points people here: It is the go-to recommendation for learning how transformers and LLMs actually work, praised for its clarity and Karpathy's teaching.

“the best video I have seen on the topic”HN comment, 2023

What Hacker News said 20

Strongly recommendsyonzJan 2023

“Andrej Karpathy's GPT video is a must have companion for this”

Clarifies key, query and value in attention.

Full comment

Great compilation, would be great to see Vision Transformer (ViT) included. Andrej Karpathy's GPT video is a must have companion for this this video I was going nuts trying to grok Key, Query,Position and Value until Andrej broke it down for me.

Strongly recommendsdurdnFeb 2023

“I was blown away”

Amazing lecture on building GPT from scratch.

Full comment

Very impressive. Recently I watched this really amazing lecture on building GPT from scratch from Karpathy, I was blown away: this video

Strongly recommendswesammikhailMay 2023

“the best video I have seen on the topic”

Intuitive, easy-to-follow explanation of how models are built.

Full comment

Andrej Karpathy, the director of AI at tesla, published an AMAZING video about how the current models are built which I think everyone in the tech space should watch. It is intuitive, easy to follow and quite frankly the best video I have seen on the topic. Here is the link: this video If you conclude, after watching this, that this is all intelligence is - namely cascading optimization and data structure problems chained in a row, then you and a fair number of people here wont ever find common ground. That is not to say that you're wrong, it just seems as if there is a missing component here that we haven't yet discovered.

in “Google DeepMind CEO Says Some Form of AGI Possible in a Few Years” · view on HN
Strongly recommendsvilledespommesJan 2024

“Andrey is an amazing educator!”

High-quality teaching by Karpathy.

Full comment

+1, Andrey is an amazing educator! I'd also recommend his this 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.

in “Implementing a ChatGPT-like LLM from scratch, step by step” · view on HN
RecommendsamrbJan 2023

“I recommend this video on the subject.”

Build GPT from scratch in code.

Full comment

I recommend this video on the subject. "Let's build GPT: from scratch, in code, spelled out." this video

in “Deep Learning Tuning Playbook” · view on HN
RecommendsqazpotMar 2023

“I would highly recommend watching and working though the code (if possible) of NanoGPT by Andrej Karpathy.”

Demystifies how LLMs work via NanoGPT code.

Full comment

I think you are taking a very major assumption that LLMs are deterministic infact they are exactly opposite. They are probabilistic systems. - They do not transpile Rough English to Deterministic English. Infact they do not do any transpiling at all. - LLMs learn the probabilities of words in the dataset for all contexts from that dataset (context is a ordered set of words). This is called training. - Once training is done, LLMs can generate text given a prompt and the probabilities that it has learned. The analogy of LLMs being auto-complete on steroids is very apt. - Whether the text generated by LLMs is factual or not is purely coincidental. I would highly recommend watching and working though the code (if possible) of NanoGPT by Andrej Karpathy. this video A lot of things which seem like magic about LLMs will get demystified. Now one can argue that LLMs are showing human like reasoning/intelligence/sentience as an emergent behavior. This is hard to argue against because all these terms are extremely hard to define. IMO, the only emergent behavior that LLMs are showing is the output they generate looks like it might have been generated by a human which should not be surprising given that LLMs like ChatGPT has trained on a large amount of human written text available on internet.

in “Flow-Based Programming, a way for AI and humans to develop together” · view on HN
Recommendsbfg_damienApr 2023

“There is also the nanoGPT series of videos by Karpathy on youtube.”

NanoGPT video series for learning LLM fundamentals.

Full comment

Here are a few resources that might help get you started: 1. A thread explaining the internal working of transformers: link 2. Paper by DeepMind which provides pseudo-code for important algorithms for Transformer models: link 3. Another thread specifically on large language models: link Once again these are not courses per se, but do provide intuitive explanations for how transformers work. There is also the nanoGPT series of videos by Karpathy on youtube. First video here: this video

in “Ask HN: How to Learn LLM Fundamentals” · view on HN
RecommendspankajdohareyApr 2023

“Karpathy's YouTube video is an excellent resource for understanding Transformers from scratch.”

Hands-on implementation of transformers from scratch.

Full comment

I agree that Karpathy's YouTube video is an excellent resource for understanding Transformers from scratch. It provides a hands-on experience that can be particularly helpful for those who want to implement the models themselves. Here's the link to the video titled "Let's build GPT: from scratch, in code, spelled out": this video Additionally, for more comprehensive resources on Transformers, you may find these resources useful: * The Illustrated Transformer by Jay Alammar: link * MIT 6.S191: Recurrent Neural Networks, Transformers, and Attention: link * Karpathy's course, Deep Learning and Generative Models (Lecture 6 covers Transformers): link ... These resources cover different aspects of Transformers and can help you grasp the underlying concepts and mechanisms better.

in “What Are Transformer Models and How Do They Work?” · view on HN
RecommendserwincoumansApr 2023

“Andrej Karpathy's 2 hour video and code is really good to understand the details of Transformers”

Clear details of Transformers with code.

Full comment

Andrej Karpathy's 2 hour video and code is really good to understand the details of Transformers: "Let's build GPT: from scratch, in code, spelled out." this video

RecommendsAlpiMay 2023

“I love all the series about writing your own X in 100 lines of code.”

Example of a from-scratch tutorial that clarifies technology.

Full comment

I love all the series about writing your own X in 100 lines of code. It gives you the understanding of technology and removes a lot of unnecessary details. The great examples of this are 'A from-scratch tour of Bitcoin in Python' link and 'Let's build GPT: from scratch, in code, spelled out' this video from Andrej Karpathy I wonder if anybody tried to collect all such projects together and built his own 'Internet in just 100 lines of code'

in “Introducing "Implement DNS in a Weekend"” · view on HN
RecommendsFranklinMaillotMay 2023

“You can check-out his other videos on NLP as well they are all excellent.”

Hands-on transformer build for a deeper dive.

Full comment

Those Computerphile videos[0] by Rob Miles helped me understand transformers. He specifically references the "Attention is all you need" paper. And for a deeper dive, Andrej Kharpaty has this hands-on video[1] where he builds a transformer from scratch. You can check-out his other videos on NLP as well they are all excellent. [0] link , link [1] this video

in “Ask HN: Can someone ELI5 Transformers and the “Attention is all we need” paper” · view on HN
RecommendssamspencNov 2023

“Karpathy is generally well-reputed as a good tutor, especially for complex topics in AI / ML.”

Karpathy's earlier GPT-building tutorial.

Full comment

I initially thought this was his older video, but I see this video was published just an hour ago (from the time of this comment). I was thinking of this other video he had published early this year: "Let's build GPT: from scratch, in code, spelled out" this video Karpathy is generally well-reputed as a good tutor, especially for complex topics in AI / ML.

in “Andrej Karpathy: Intro to Large Language Models [Video]” · view on HN
RecommendssolomatovJan 2024

“You could watch this for a start”

Starting point for training your own small LLM.

Full comment

Yes, it's doable. Your model won't be as large and as performant as a real large scale model, but you could train something. You could watch this for a start: this video

in “Ask HN: Is it feasible to train my own LLM?” · view on HN
RecommendsyregDec 2024

“Karpathy has a nice video tutorial about building an LLM”

Video tutorial on building an LLM.

Full comment

Attention is all you need and GPT-2 were well known at that point. Many might doubt whether this approach leads to "general" intelligence – depends on the definition. BTW, Karpathy has a nice video tutorial about building an LLM: this video

in “A ChatGPT clone, in 3000 bytes of C, backed by GPT-2 (2023)” · view on HN
Cites itsebastianconcptJan 2023

Karpathy discusses a challenging part.

Full comment

I remember Andrej mentioning in [1] that is a challenging part, what materials/lectures/papers have you found or what ideas on what to do about that so far for that? [1] this video

in “Training NanoGPT on My Journal” · view on HN
Cites itIzkataApr 2023

“I haven't gotten around to watching it yet”

Two-hour build of GPT from scratch.

Full comment

2-hour video posted a month or two ago in a comment here: "Let's build GPT: from scratch, in code, spelled out." this video (I haven't gotten around to watching it yet)

in “A Completely Non-Technical Explanation of Deep Learning” · view on HN
Cites itpetemirJun 2023

Related episode in Karpathy's course.

Full comment

There was this comment a couple of weeks ago ( link ). Perhaps also episode 7 of Karpathy’s “Neural Networks: From Zero to Hero” course ( this video )

in “Attention is Turing complete [pdf]” · view on HN
Cites itjiggawattsJul 2024

“a thousand lines of code that can be banged out in a couple of hours by one guy while talking in a YouTube video”

Shows transformers are small enough to code in a video.

Full comment

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 water by Transformers, which does all of that and much more with a thousand lines of code that can be banged out in a couple of hours by one guy while talking in a YouTube video: this video Transformers will revolutionise this entire space, and more that don't even exist yet as a market. Take for example humanoid robots: Boston Dynamics has had the hardware working well enough for a decade, but not the software . You can't walk up to one of their robots, point at something, and tell the robot to complete a task. It can't understand what it is seeing, and can't understand English instructions. Programming that in with traditional AI methods would take man-millenia of effort, and might never work well enough . If we could speed up GPT-4o (the one with vision) to just 10x or 50x its current speed, with some light fine-tuning it could control a humanoid robot right now with a level of understanding comparable to C3P0 from Star Wars!

Cites itatum47Aug 2024

Asks how this relates to Karpathy's video.

Full comment

Excuse my ignorance, is this different from Andrej Karpathy this video Anyway I will watch it tonight before bed. Thank you for sharing.

in “Building LLMs from the Ground Up: A 3-Hour Coding Workshop” · view on HN
Cites itzerdJan 2025

“The one you linked to is based on Karpathy's tutorial”

Basis for the linked project, trained on Shakespeare.

Full comment

The one you linked to is based on Karpathy's tutorial: this video , except changing to train on tinystories in stead of Shakespeare. smolGPT also looks inspired by nanoGPT, also from Karpathy: link

in “SmolGPT: A minimal PyTorch implementation for training a small LLM from scratch” · view on HN