Skip to content
0:00 / 0:00

#chatgpt#transformer#largelanguagemodels

Deep Dive into LLMs like ChatGPT

Andrej Karpathy

1.7M subscribers • 6 videos on Hallway

YouTube

Beginner. No background in the topic needed.

10M views1 year ago10 recommendations

AI and machine learningTransformers and LLMsNeural networks and deep learningTraining and serving models

Andrej Karpathy explains the full training stack of Large Language Models, from pretraining to post-training, and provides mental models for their behavior.

This is a general audience deep dive into the Large Language Model (LLM) AI technology that powers ChatGPT and related products. It is covers the full training stack of how the models are developed, along with mental models of how to think about their "psychology", and how to get the best use them in practical applications. I have one "Intro to LLMs" video already from ~year ago, but that is just a re-recording of a random talk, so I wanted to loop around and do a lot more comprehensive version. Instructor Andrej was a founding member at OpenAI (2015) and then Sr. Director of AI at Tesla (2017-2022), and is now a founder at Eureka Labs, which is building an AI-native school. His goal in this video is to raise knowledge and understanding of the state of the art in AI, and empower people to effectively use the latest and greatest in their work. Find more at karpathy.ai/ and x.com/karpathy Chapters introduction pretraining data (internet) tokenization neural network I/O neural network internals inference GPT-2: training and inference Llama 3.1 base model inference pretraining to post-training post-training data (conversations) hallucinations, tool use, knowledge/working memory knowledge of self models need tokens to think tokenization revisited: models struggle with spelling jagged intelligence supervised finetuning to reinforcement learning reinforcement learning DeepSeek-R1 AlphaGo reinforcement learning from human feedback (RLHF) preview of things to come keeping track of LLMs where to find LLMs grand summary Links - ChatGPT chatgpt.com/ - FineWeb (pretraining dataset): huggingface.co/spaces/HuggingFaceFW/blogpost-fineweb-v1 - Tiktokenizer: tiktokenizer.vercel.app/ - Transformer Neural Net 3D visualizer: bbycroft.net/llm - llm.c Let's Reproduce GPT-2 github.com/karpathy/llm.c/discussions/677 - Llama 3 paper from Meta: arxiv.org/abs/2407.21783 - Hyperbolic, for inference of base model: app.hyperbolic.xyz/ - InstructGPT paper on SFT: arxiv.org/abs/2203.02155 - HuggingFace inference playground: huggingface.co/spaces/huggingface/inference-playground - DeepSeek-R1 paper: arxiv.org/abs/2501.12948 - TogetherAI Playground for open model inference: api.together.xyz/playground - AlphaGo paper (PDF): discovery.ucl.ac.uk/id/eprint/10045895/1/agz_unformatted_nat… - AlphaGo Move 37 video: youtube.com/watch?v=HT-UZkiOLv8 - LM Arena for model rankings: lmarena.ai/ - AI News Newsletter: buttondown.com/ainews - LMStudio for local inference lmstudio.ai/ - The visualization UI I was using in the video: excalidraw.com/ - The specific file of Excalidraw we built up: drive.google.com/fi

Why it's here

10 people recommend this

What people say. Highly recommended as an exceptionally clear and approachable deep dive into how large language models work under the hood.

InvidFloweron Hacker News • Recommends

On “Ladder: Self-improving LLMs through recursive problem decomposition”

I think you'll get a lot of use from this video from Andrej Karpathy: link to this video It is long, but don't get scared off. He goes over a ton of different stuff related to model training, but makes it very easy to understand.

GodelNumberingon Hacker News • Recommends

On “Show HN: I made a free tool that analyzes SEC filings and posts detailed reports”

Depending on how much time you have, the first thing I would recommend is to watch Karpathy's 'deep dive into LLMs' video ( link to this video ). It is 3.5 hours but it will give you so much instinctive understanding of how these things work and will likely save you a lot of time. Purely from a technical standpoint, things aren't that difficult really. I'd recommend get yourself an API account with all major providers (because each frontier LLM evidently has their own strengths and weaknesses) and start experimenting with your data. The feeling you'll get when you first get an API response will keep you going! :) Having said that, a caveat is, LLMs do hallucinate from time to time. If your data needs a…

runjakeon Hacker News • Recommends

On “Ask HN: Build Your Own LLM?”

Since you're posting here, you're looking for the shortcut. The shortcut is Karpathy's "Let's Build GPT: from scratch, in code, spelled out" video: link Then there is a good video that dives into LLMs and how they work that is quite approachable: link to this video From there, flesh out knowledge with his other videos, where he goes both extremely light and extremely deep: link Anyway, I really like's Karpathy's video because he's very good at explaining LLMs at every level.

pengaruon Hacker News • Recommends

On “LLMs are bullshitters. But that doesn't mean they're not useful”

This is like the LLM era version of the search bubble that prevented people from having the same search results for ostensibly identical searches. Also keep in mind that LLMs are stochastic by design. If you haven't seen it, Karpathy's excellent "deep dive into LLMs like chatgpt" video0 explains and demonstrates this aspect pretty well: 0 link to this video

romanhnon Hacker News • Recommends

On “Ask HN: What would you recommend a vibe coder learn about how all this works?”

I highly recommend Andrej Karpathy's Deep Dive into LLMs like ChatGPT: link to this video . It's a 3.5 hour general intro to the topic that I think does a great job of making sense of the tech and how it works under the hood, without needing to build up a foundation of math and programming.

etotheton Hacker News • Recommends

On “Microgpt”

Even if you have some basic understanding of how LLMs work, I highly recommend Karpathy’s intro to LLMs videos on YouTube. - link to this video - link

wzddon Hacker News • Recommends

On “Tracing the thoughts of a large language model”

…thing). It's more to do with post-base training specifically being about providing positive rewards for things which aren't hallucinations. Changing the way the reward function is computed during RL doesn't produce planning, it simply inclines to model to produce responses that are more like the RL targets. Karpathy has a good intro video on this. link to this video In general the nitpicking seems weird. Yes, on a mechanical level, using a model is still about "given this context, what is the next token". No, that doesn't mean that they don't plan, or have higher-level views of the overal structure of their response, or whatever.…

highhedgehogon Hacker News • Recommends

On “Ask HN: If you had 100 hours to learn something new, what would you learn?”

There is a very good intro on how LLM work by Kharpaty. It's link to this video and it's 3.30 hours, so way below the 100 hours mark :)

matthewolfeon Hacker News • Recommends

On “Show HN: TokenDagger – A tokenizer faster than OpenAI's Tiktoken”

Modal's GPU glossary is a good overview about how GPUs work 0. Karpathy's LLM overview is a good high level overview on LLMs 1. 3b1b's video (and subsequent videos) on transformers was excellent at helping me understand the math at a high level 2. This matrix multiplication optimization worklog helped me understand writing better CUDA (not for beginner intro though) 3. During this process I also asked ChatGPT a lot of questions. I'm definitely open to suggestions about "how to learn" with all the new tools we have. I felt this has not been straightforward to figure out. 0 link 1 link to this video 2 link 3 link

npallion Hacker News • Recommends

On “Neural Networks: Zero to Hero”

This is a good resource, however for about 99.99% of people, you are most likely to just use a foundation model like ChatGPT, Claude, Gemini etc. so this knowledge/training will get you neither here or there. I would suggest you look into another Karpathy's video -- Deep Dive into LLMs like ChatGPT. link to this video

huseyinkeleson Hacker News • Mentions

On “Claude 3.7 Sonnet and Claude Code”

Okay, I feel like there might've been a breakthrough here. After watching Karpathy's video 0, he mentioned how hard it is for LLMs to have humor and be funny but it seems like Claude 3.7 really nailed it this time? Like, most of these posts are legit funny. 0 - link to this video

thijsonon Hacker News • Mentions

On “Ask HN: Any insider takes on Yann LeCun's push against current architectures?”

I watched an Andrej Karpathy video recently. He said that hallucination was because in the training data there were no examples where the answer is, "I don't know". Maybe I'm misinterpreting what he was saying though. link to this video

insinon Hacker News • Mentions

On “AI LLMs can't count lines in a file”

…ter outcome, but I took their prompt asked it to write code instead, and got it translated into some overly-commented but simple-enough code which would do the job perfectly every time, including a comment that the instructions they'd provided had a gap where people answering with a certain combination of answers wouldn't fall into any bucket. 1 link to this video…

paulirishon Hacker News • Mentions

On “Yt-transcriber – Give a YouTube URL and get a transcription”

Can also just fetch the subs already in YouTube rather than retranscribing. eg: yt-dlp --write-auto-subs --skip-download " link to this video "

tdidoon Hacker News • Mentions

On “Persona vectors: Monitoring and controlling character traits in language models”

That's actually pretty much what Andrej Karpathy mentions as a mitigation for hallucinations here: link to this video

rsanekon Hacker News • Mentions

On “The maths you need to start understanding LLMs”

Anyone else read the book that the author mentions, Build a Large Language Model (from Scratch) 0? After watching Karpathy's video 1 I've been looking for a good source to do a deeper dive. 0 link 1 link to this video