Published November 7, 20221:08:4710 fact-checks

Anton Teaches Packy AI | E1

Anton Troynikov walks Packy McCormick through "Attention Is All You Need" box by box, three weeks before ChatGPT launched.

Chapters

Quotes

  • On a "classic" from 2017

    “I love that this paper is now considered old. This thing is from 2017. We're here in 2022, and in five years, this is now old.”

    Anton TroynikovRead from 04:02
  • On backpropagation

    “Backpropagation, which is the way everything is done now, was an original idea at the time. It was not at all obvious that that's what you should be doing.”

    Anton TroynikovRead from 21:04
  • On the addition in Add & Norm

    “But it turns out that this is enough to propagate information deeply into the network, to just do that addition with the original input. It blows my mind that this works.”

    Anton TroynikovRead from 33:02
  • On the buzzword "emergent"

    “I think ‘emergent’ just means ‘surprising’ in a lot of cases.”

    Anton TroynikovRead from 36:54
  • On the aesthetics of machine learning

    “Generally speaking, ML people, and I don't know, technical people in general, are looking for simple things that work surprisingly well rather than elegantly constructed complex things.”

    Anton TroynikovRead from 39:33
  • On why we forgive models' nonsense

    “We're designed as humans to error-correct, right? So we're very lenient towards the model as well.”

    Anton TroynikovRead from 56:08
  • On the cost of training GPT-3

    “$6 million is nothing for a capability like this. You and I both know people with $6 million in their couch cushions.”

    Anton TroynikovRead from 1:03:56

Summary

Anton Troynikov, co-founder of Chroma, takes Packy McCormick through the 2017 paper "Attention Is All You Need" one diagram box at a time: why attention, which looks at the whole text at once, beat recurrent networks; how the encoder and decoder fit together; and how a model that only ever predicts the next token ends up writing coherent text. Along the way come tokens, weights and gradients, why GPUs matter, and why a simple architecture fed lots of data keeps beating clever designs.

Anton's verdict: the transformer is a simple model that trains fast and cheap and underpins nearly every large model, but its limit will be data, not compute, because the internet's text is about to run out.

Advice

  1. Read foundational papers even if you don't do research: they show where new capabilities come from and where a given advance sits on the map.

  2. If you're right more often than you're wrong, make decisions faster: decision speed alone accelerates a company's growth.

  3. Don't sink effort into clever architecture tricks when a simple approach works: a simple model and more data usually win.

  4. When training a large model, plan for GPU failures: the training loop has to survive broken hardware instead of restarting at 99%.

Mentioned

  • Tim Cook00:04Packy opens with the meme of Tim Cook puzzling over a chip: that's how he looks reading AI papers.
  • Chroma01:24Anton explains that his company uses a model's internals to suggest what data to fine-tune it on, and later that this is how Chroma helps with large models.
  • DARPA Grand Challenge01:49Anton names these self-driving races as the moment machine learning first really worked in robotics.
  • GPT-304:17The defining model of 2022 in this conversation: Anton cites it as proof that models' capabilities aren't exhausted, and Packy plays with it in the Playground.
Show 24 more mentionsShow fewer mentions
  • Stable Diffusion04:17Packy cites it, along with GPT-3, as what grew out of the 2017 paper within five years.
  • Ben Thompson05:31Packy first noticed "Attention Is All You Need" in one of his interviews.
  • Daniel Gross05:31One of Ben Thompson's two guests in the interview where Packy heard about the paper.
  • Nat Friedman05:31The other guest in that interview; Anton later quotes his tweet "AI is Ellis Island for crypto refugees."
  • Andrej Karpathy05:31Packy heard him mention the paper on Lex Fridman's podcast and contrasts his faith in a long life for transformers with Anton's skepticism.
  • Attention Is All You Need06:18The paper Anton and Packy take apart all episode, box by box, using its architecture figure.
  • Transformer Circuits08:47Anton recommends this line of research for understanding the computational paths that actually run through a transformer.
  • Anthropic08:47Anton names it as the company behind the Transformer Circuits research.
  • Chris Olah08:47Per Anton, he runs the interpretability research behind Transformer Circuits.
  • The Bitter Lesson34:11Anton cites the essay to explain why no one looks for a replacement for the "information-destroying" addition: if the simple thing works, let it.
  • Training Compute-Optimal Large Language Models35:40Anton promises to cover the Chinchilla scaling laws next episode and uses them to predict that text data will soon run out.
  • Large Language Models Can Self-Improve37:39Anton cites it as an example of abilities found in models without new data, though he describes it inaccurately.
  • OpenAI38:22Anton asks whether Packy has free OpenAI credits, and Packy admits his bill for two weeks was 82 cents.
  • Not Boring40:16Packy says "Attention Is All You Need" sounds more like a headline from his newsletter.
  • You Only Look Once: Unified, Real-Time Object Detection40:26Anton recommends this paper with a great title, "written by an absolute madman."
  • GitHub Copilot42:07Anton uses it to show how a model offers several continuations by taking less likely tokens.
  • Boston Dynamics50:35Anton jokes that he taunts AI the way he'd kick a Boston Dynamics dog to see if it stays up.
  • BERT51:18Anton's example of a different training task: restoring randomly deleted words.
  • PaLM51:18Anton puts it alongside BERT as a big model used to try different training methods.
  • Training language models to follow instructions with human feedback51:18Anton's example of fine-tuning: unlike the first GPT-3, it does what you ask instead of describing it.
  • Elon Musk51:49Anton uses "write it like Elon Musk would" to show how attention picks up on words in the prompt.
  • NVIDIA1:01:56Anton says NVIDIA got really lucky: gaming GPUs turned out to do exactly what machine learning needs.
  • Explainpaper1:04:56Anton's friend's tool: Packy first read the paper with it, and both recommend it to viewers.
  • Genius1:06:27Anton and Packy recall it as an earlier attempt to annotate the whole internet.

Transcript

01Why Packy wants AI papers explained

The series began with a tweeted meme, on the premise that AI moves by research papers and reading them is a way to glimpse the future.

Welcome to Anton Teaches Packy AI. This is an experiment that we're running. I guess it was two weeks ago at this point, I tweeted some meme of Tim Cook looking at a chip when he was on a tour of one of Apple's offices or factories or something, saying that this is me when I try to read an AI research paper. Anton replied saying that he'd be happy to do a weekly thing where he explains the papers to me. I feel very lucky to be in a position where smart people are willing to take the time.

And we figured, as we were talking back and forth, that there's probably a lot of questions that people have who are broadly interested in the space but have no idea what's going on. They're just seeing all of this crazy stuff coming out. So we decided to just hit record on these conversations. I've never done video stuff before. I have a face for podcasts, but I think it's going to be fun to look through the papers as we go, put videos up. We're going to start with one paper today.

I think over time I'll have questions on particular papers. Would love to hear what people who end up watching this want to dive into with you. But I don't know, I'm really excited. I think this is going to be fun to nerd out and go deeper than I was hoping to be able to go in this world. Before we get started, big question is: Anton, who are you? How did you get to this point where you're able to explain what's going on in these papers? Tell us about yourself.

Yeah, sure. Packy's asking me, "Anton, who are you? How did you get on my stream? Why is this happening?" So I'm Anton. I'm the co-founder of a company called Chroma.1Chroma — at the time Anton and his co-founder Jeff Huber were building tools that use a model's internals to suggest what data it needs. In early 2023 Chroma released what it is known for now: an open-source vector database where AI applications store embeddings and search them. Chroma. We make machine learning tooling. And one of the things that we do is use model interpretability,2Interpretability — the branch of machine learning that works out why a model gave a particular answer: which inputs and which internal parts of the model drove it. which is understanding how the model actually does what it's doing, to do things like automatically optimize your training data set from the data your model sees in production, and lots of other cool things that we build on top of that.

So I built this company, or started building this company, because of my last, you know, seven or eight years of experience, especially in robotics, where I worked mostly on problems in what's called perception,3Perception — in robotics, the part of the system that builds a picture of the world from cameras, lidar and other sensors: where the road is, where the people are, where they're moving. which is about getting computers to understand the real world and what's going on in it, usually in 3D and in very dynamic environments where there's people and things moving around. And one of the critical tools in making all of that work has been machine learning, from very early on: in about 2004 we had the first real machine learning models deployed in the DARPA Grand Challenge,4Fact-checkNot quite: at the first DARPA Grand Challenge in March 2004, no vehicle made it even 12 km of the 240 km course. Machine learning helped win the second one, in 2005: Stanford's Stanley learned to tell drivable road from rough terrain and covered 212 km of the Mojave Desert in under seven hours. Pictured: Stanley. Wikipedia. where we saw that, okay, maybe the possibility of self-driving is now actually within reach. Even though we haven't reached it yet, maybe we're close.

And I think especially over the last two years, there's just been almost a phase shift, like a huge change in the capabilities and features that machine learning has and the things that they can do. And as somebody who has a background in this stuff, coming from computer science, applied mathematics, robotics, I've stayed on top of that research. And then now that I've founded Chroma, it's kind of my job to stay on it, know what's going on, understand the models that people are using and the new ones that are coming down the pipe. So that's me by background.

Yeah, it's cool. I worked at a startup before this, but not in a technical role; that startup was in real estate. And I think most people will be more familiar with the part of the tech world where the things that we're interacting with aren't necessarily so clearly based on research papers, right? Like if you're using a new B2B SaaS product, it's because somebody came up with a clever new workflow, or something that annoyed them that they think, oh yeah, this off-the-shelf stuff can help solve. But where I've spent a lot of the time over the past year or so, in crypto, it's very white paper driven.5White paper — in crypto, the document in which the authors lay out how a new protocol or token works. The most famous is Satoshi Nakamoto's nine-page Bitcoin paper (2008). And then certainly AI/ML seems to be very, very research paper driven, where these papers come out and then it opens up this whole new world of exploration for other people.

So I think this is going to be a fascinating way to dive in and maybe even see the future a little bit, like, as these papers come out, cool, what can people do with these things? So we're going to start with a paper that's a bit more foundational. I think it's about five years old. And so the things that are in the future from this one…

I just want to interject. I love that this paper is now considered old. This thing is from 2017. We're here in 2022, and in five years, this is now old. But it is really foundational. I'm glad we're starting with this one.

I mean, hopefully when we start looking at the ones that are coming out now, you can predict that in five years we'll have things like GPT-36GPT-3 — OpenAI's 175-billion-parameter language model, described in May 2020 and sold to developers through an API from June 2020. ChatGPT, built on its successor, would come out three weeks after this recording, on November 30, 2022. and Stable Diffusion7Stable Diffusion — an open model that draws images from text descriptions, released in August 2022, three months before this recording, by Stability AI and researchers at the University of Munich. and whatever else that are based on top of it. But I think that's one of the cool things here: if we're understanding what's going on in the research papers, maybe you can understand what these models are going to be able to do a little bit better.

There's this interesting phenomenon as well, right? Where in a lot of ways we're actually still exploring the possibilities of even the models we have today while new ones are still coming down the pipe. It's pretty incredible. People are doing more and more interesting things with GPT-3, even though that's probably about a year and a half old8Fact-checkWrong: GPT-3 was almost two and a half years old by then — the paper came out on May 28, 2020, and the API opened on June 11, 2020. arXiv. now, right? We've seen the step-by-step prompting.9Step-by-step prompting — in May 2022, researchers at the University of Tokyo and Google found that adding the single phrase "Let's think step by step" raised GPT-3's (text-davinci-002) accuracy on the MultiArith math problems from 17.7% to 78.7%. Two years later this grew into "reasoning" models like OpenAI's o1 (September 2024), trained to reason before answering. Kojima et al., 2022. We've seen the self-introspection stuff very recently. And the architecture hasn't changed. It's literally like, look at this new neat thing that this thing can do. And that's going to keep happening as well.

I think the value, especially for people who are not necessarily in the technical depth or doing the research themselves, of reading these papers and understanding them is at least getting a feel for where stuff might be coming from, and getting a taste of where a given advance fits into the entire landscape. I think that's why this is kind of cool and important.

You anticipated my first question, which we'll get to in a second. And just so I can save face here, an audience note: I'm really dumb naturally, but also I'm going to intentionally ask dumb questions so that we can get to the real basic understanding of what's going on, and then I'm sure as these go on we'll build up from there. But I'm going to be the useful idiot here, which I think is a role that I was born to play. So when we were going back and forth on Twitter, you said to pick your favorite research paper, I said you pick, and then you picked this paper that I had heard of. I maybe heard of it before, but just that week had seen it in Ben Thompson's10Ben Thompson — author of Stratechery, one of the most influential paid newsletters on tech strategy. interview with Daniel Gross and Nat Friedman,11Daniel Gross and Nat Friedman — investors who backed AI startups together; Friedman ran GitHub in 2018–2021, when it built Copilot. The Stratechery interview came out in fall 2022 and covered the democratization of AI, the story of Copilot and where Stable Diffusion came from. Both joined Meta in 2025. Stratechery. and then was listening recently to the Lex Fridman podcast with Andrej Karpathy,12Andrej Karpathy — an OpenAI founding member who led AI at Tesla in 2017–2022. His conversation with Lex Fridman is episode #333, released October 29, 2022, a couple of weeks before this recording. and he mentioned this paper.

02What the paper changed: parallel instead of one word at a time

The transformer processes the whole text at once and shortens the path of the training signal, so it learns faster and better than recurrent networks.

It seems to be the foundational paper for everything that's going on now. Without further ado, I'm going to put it up on the screen. We're getting fancy with the video technology here. Let's go: "Attention Is All You Need." So this paper came out, as I said, I think in December of 2017.13Fact-checkNot quite: the preprint went up on arXiv on June 12, 2017; in December 2017 the paper was presented at the NIPS conference in Long Beach. arXiv. I guess to start off, can you give an overview of the state of play before "Attention Is All You Need" came out, and what the big shift was when the paper came out?

Yeah, and I actually think that's probably the single most important thing about this paper: to understand it in context, what it really did and why it was such a huge advance. So prior to "Attention Is All You Need," most of what was being done in text modeling and language modeling was the use of these recurrent networks.14Recurrent network (RNN) — reads text one token at a time, updating an internal state, a "memory" of what it has read, after each one. So it can't process the hundredth word until it has processed the first 99. And the thing that a recurrent network does is you have to wait for it to output and then read that output back into itself, so it can only do things sequentially. But a model based on attention alone allows you to compute multiple parts of what you need for the model from the input sequence in parallel, which is a huge advance. And it also reduces, in some sense, the distance between the effect a given token in the input has and what the model's doing, which means it makes it easier for the model to learn those relationships as well.

Those are the two big things. Before "Attention Is All You Need," LSTMs15LSTM (long short-term memory) — a recurrent network with "gates" that decide what to remember and what to forget, invented by Sepp Hochreiter and Jürgen Schmidhuber in 1997. Before the transformer, Google Translate and speech recognition ran on LSTMs. Wikipedia. were common, various recurrent models were common, and now we have attention, and people think of it as this class of models called the transformers. It turns out that this works really, really well precisely because you can ingest a wide amount of context in parallel and then train it in such a way that all of that context is appropriately absorbed, as opposed to being really, really far away from where the training needs to happen, conceptually. Hopefully that makes some kind of sense. I'm also not above saying dumb or wrong things on this recording, so I'm sure that if I do say something wrong, people will correct me. And I think it's the beauty of the internet.

My first question there, and something that I was wondering when I was reading through the paper: does parallelization let you do things that you couldn't have otherwise done? Or, given infinite GPUs and infinite time, could a recurrent model have done something similar, and this just helps it get done faster, cheaper than with recurrent models?

So that's a really good question. I think, generally speaking, the fact that it's parallel hides a bunch of other stuff, which was discovered and figured out later about this particular architecture. There's a great resource called… well, it's not a resource, it's actually an entire research direction called Transformer Circuits,16Transformer Circuits — Anthropic's series of papers that take a transformer apart like a circuit diagram, looking for the internal "circuits" behind particular behavior. The first was "A Mathematical Framework for Transformer Circuits" (December 2021). Anthropic was a young company then, founded in 2021 by OpenAI alumni. transformer-circuits.pub. from a company called Anthropic. It's run by Chris Olah17Chris Olah — an Anthropic co-founder; at Google Brain and OpenAI he became known for visual essays on what happens inside neural networks. colah.github.io. and a few other people in this model interpretability space. I'll send you the link later on. But what they do in that line of research is break down what the paths are, what the actual computational paths are through the model.

And this paper also alludes to the shortening of those computational paths. So besides making it more computationally efficient, and besides actually making it efficient enough to train on a vast corpus of data in a human-reasonable amount of time, shortening those paths by making them parallel instead of sequential means it trains better. It's better able to understand more context, and being better able to understand more context is how language models have gotten so good lately. They're still not quite there, but they're doing really, really well.

And how does that work? And that might be an overly simple question, but how does it let them train better?

Yeah, so if you imagine a recurrent model, right? The first tokens in the sequence, the model is going to see them first and respond to them. You can imagine, it's training, so it's going to respond to them.

Just to do very, very basic: when we say token, we're not talking about crypto, we're not talking about Chuck E. Cheese.18Chuck E. Cheese — an American chain of family pizza-and-arcade restaurants whose games long ran on the chain's own tokens. What is a token here?

A token is usually a word in a string. So a token is usually a word, but it can also be certain characters. It can be partial parts of a word. You'll see tokenization where even apostrophes or commas, quote marks are used almost as if they were their own word. It's basically just how you break up a sequence of text into pieces. Each piece of text is called a token.19Tokens in GPT-3: a vocabulary of 50,257 pieces built by the BPE algorithm. Common words are one token, rare ones are split; on average a token is about four characters of English, or three-quarters of a word. OpenAI.

Cool. That makes sense.

I'm sure someone has tried to turn this into actual crypto tokens. I'm sure we'll see that startup very soon. Someone is going to be like, "What is the intersection of crypto and AI? They both have tokens." And then somebody's going to start doing that.20That's what happened: in July 2023 Worldcoin, co-founded by Sam Altman, launched its token, and in 2024 traders piled into "AI tokens" like Bittensor and tokens for AI agents.

I do… This is for a future conversation. I do have thoughts on that intersection somewhat, but they're not fully formed enough for me to say on this exact episode.

But Nat Friedman has this great tweet which I keep quoting, because the sentiment has gone around lately with just how the environment is right now, which is: "AI is Ellis Island for crypto refugees.21Ellis Island — the immigration station in New York Harbor that processed about 12 million arrivals between 1892 and 1954. The joke: after the 2022 crypto crash, engineers and investors were flocking to AI." And it's such a good summary of a lot of what's happening right now. But yeah, I mean, that's a different conversation.

Yeah, no, I mean, I'm here having a conversation with you about AI after writing a lot about crypto. The charitable interpretation, which I'm going to give myself, is that that was the most fascinating thing happening over the past couple of years.22The 2022 crypto winter — in May the TerraUSD stablecoin and the Luna token collapsed; that summer the lender Celsius and the fund Three Arrows Capital went bankrupt. A few days after this recording, on November 11, the exchange FTX would file for bankruptcy. This is very clearly the most fascinating thing happening. If you're interested in just what is the weirdest, furthest-out stuff that we can do on the internet, those are the two answers for the past couple of years. And I hope that the weirdest, furthest out in a little while is what happens when the two of them come together. But back to "Attention Is All You Need." So I interrupted you to ask a dumb question about tokens. We were going over, I guess, why they're able to train better with parallelization.

03How a model learns: weights, loss and gradients

Training means tuning a model’s numbers, its weights, so that its error shrinks, and in a transformer the error signal reaches every part by a shorter route.

Recurrent network: along the chain5 stepsAttention: directly1 stepword 1word 6
How far word 1 is from word 6: in a recurrent network the signal passes every step in between; with attention any word is one step away.

That's right. That's right. And it's just that the paths from the feedback signal to the weights in the model are shorter in the parallel architecture than they are in an LSTM, in a recurrent model. And that means that, again, conceptually you can think of it as each part of the model, because it's doing it in parallel rather than this deep serial stack, it's more like a wide parallel stack. And again, these are gross simplifications about what's really going on. But conceptually what that means is the path for the feedback signal to arrive at each part of the model is shorter than in the very deep recurrent setting.

And so that means you learn better. It's like… I'm trying to think of a good analogy. It's like, you know, imagine… That's a terrible analogy. I'm not going to use that one.

Give it, give it.

I was like, imagine you're trying to reach across the room with… You know, when you were a kid, you have a tape measure, or maybe you still do this. Actually, I still do this. You have a tape measure and you extend it, and then if you extend it too far, it folds down. If you have a bunch of tape measures of equal length, they won't fold down. It's not really like that, but it's fun to think about.

It makes sense. It also brings to mind for me, I remember we had Ben Rollert,23Ben Rollert — co-founder and CEO of Composer (2020), a service for building trading strategies without code and running them automatically. Breather, where he and Packy worked, rented out offices and meeting rooms by the hour or the month. who I used to work with at Breather, who runs a company called Composer now. I remember he just, as a toy model, ran this thing where he thought we were being too slow in the company. And so he was like, all right, assuming that you make even just 51% the right decision, or 49, what does it look like if you just make those decisions a whole hell of a lot faster? What happens to your company's growth trajectory? And if you're right more than you're wrong, you should make more decisions more quickly.

And obviously… Actually, this brings up another question. You need to weight things correctly, I guess; not all decisions are created equal. But when you say that this learning then weights the model, what's happening there?

Right. So when we talk about model weights, they're the parameters of the model itself. It's basically numbers, like the class in machine learning, right? You have the model weights, which are numbers that the model actually stores. They're part of the model itself. And then you've got another set of numbers which represent the input, and we can talk about how words get turned into numbers in a little bit.

You have numbers which represent the input, and those numbers get multiplied together, or different things happen together. And so the weights stay the same, but for different inputs, multiplying by those weights, or functions of those weights multiplied by the inputs or whatever, creates the output. So when I say model weights: when a model gets trained, that model's weights are a full description of that model. That's what I mean when I say weights. Yeah.

And the things that impact those weights. So if GPT-3 trains on the whole internet, is it too simplistic to think about it like, if it sees the same thing happening in a lot of different ways in a lot of different places across the internet, then it weights those things proportionally more? Or what's the right way to think about it?

ExplainerHow a neural network learns

Weights are the millions (in GPT-3, 175 billion) of numbers a model stores and multiplies its inputs by. Training means finding the right weights.

  1. The model makes a prediction — say, which word comes next.
  2. The loss measures how far the prediction is from the right answer: a single number, the smaller the better.
  3. The gradient is the derivative of the loss with respect to each weight: which way and how far to turn each weight to shrink the error.
  4. Backpropagation computes these gradients layer by layer, from the network's output back to its input.
  5. The weights take a small step against the gradient — gradient descent — and the whole thing repeats on the next batch of data, millions of times.

The human in this loop picks the data, the architecture and the training settings; the program finds the weights.

Not exactly. Not exactly. The weights of the model are the things that get changed as the model trains. So there's a thing called a loss, and a loss is basically just the difference between the output that you want and the output that a model is giving you right now. And the basic algorithm of all machine learning models is: you compute your loss, which is some difference, and there's lots of ways to write down a loss, but just imagine it as the difference between what you have and what you want. And then you compute what's called a gradient.

So a gradient is basically the derivative of the loss with respect to the weights. It's a calculus thing, but basically it says, okay, which direction do I need to turn each of the numbers that represent my network in order to make that loss less, and therefore get closer to what I actually want each time I make a prediction. That's the basic training algorithm of all machine learning models. And so when you have an internet's worth of text, right, and the model will see similar words used in similar patterns, that will help push the model's weights in the right direction. It's not so much that seeing the same thing a lot makes it weighted more. That's not really the way to think about weights. It's more like seeing the same thing in different patterns makes the model figure out what it should predict when it sees those patterns in its input.

04Why the transformer was tested on translation

Machine translation is an old, hard problem where success is easy to measure, because the web is full of paired texts.

Got it. Okay, that makes sense. And so in the paper, they talk about an English-to-German translation task. And is the point of that that you have this dictionary in front of you and you can say, this is what I'm trying to get, I'm starting here, and so how do you minimize the loss? Or why are they testing on English to German?

Yeah, so translation tasks are a really classical application of what's called natural language processing. Natural language processing is probably one of the oldest fields in AI, because it's one of the things that we wanted to figure out how to do first. Machine translation was of critical defense importance also, for a long time. So back in the '50s, and even as early as the late '40s, the government was pouring tons and tons of money into research about this.24The Georgetown–IBM experiment — on January 7, 1954, IBM and Georgetown University demonstrated a machine that translated more than 60 Russian sentences into English. They promised to solve translation in three to five years; in 1966 the ALPAC report judged machine translation a failure, and US funding was cut. Wikipedia. And for the longest time we had expert systems,25Expert systems — programs into which people hand-code the rules of a field. In translation that meant dictionaries and grammar rules; such rule-based machine translation dominated until statistical methods displaced it in the 1990s. where linguists and human translators would sit down and try to encode all of the rules in language into these computer systems. And they never worked terribly well, right?

And then for a long time, even machine systems, they kind of worked. They were kind of okay. And the reason for that was they would lose context. So if you had a long sentence… I'm trying to think of a good sentence. There are things called Winograd schemas,26Winograd schema — a pair of sentences that differ by one word and take common sense to resolve: "The city councilmen refused the demonstrators a permit because they feared violence" — "they" is the council; "…because they advocated violence" — now it's the demonstrators. Terry Winograd came up with the example in 1972. Wikipedia. but there's long sentences where it loses track of what the sentence is actually talking about. And that messes up the translation. And you can imagine how complex that gets when you have languages that are different to English.

So for example, English doesn't have gendered nouns. German does. And not only does German have gendered nouns, German has five verb cases.27Fact-checkWrong: German has four cases — nominative, accusative, dative and genitive — and they belong to nouns, not verbs. Wikipedia. I happen to know this because I speak German, but it has all of these cases. And so even getting from the rules of grammar for English into the rules of grammar for German, to have the same meaning, is a very, very difficult task. It's a classical problem in AI overall, and natural language processing in particular.

So to throw this kind of a model at a translation task and have it work well is a demonstration of the power of the model. It shows that, yeah, this is actually really, really strong compared to our other efforts; in being able to do this, this is just better. And the translation task is also something that you can test, because in many places, especially on the web, you have identical pairs of text, right? And that's one of the things that you really need for models like this. You need pairs of text, and you can think of them today in terms of a prompt and a completion.28Completion — OpenAI's API term for the text a model writes to continue a prompt. So a prompt is your input, a completion is your output. And so it's easy to find pairs of text that are like, okay, my prompt is this English text and my completion is this German text.

And so that's why they do the translation task. It's an important task. If you can do it, it shows that your model's performing really well.

And it's classically very hard.

05Neural networks, transformers and LLMs: what contains what

A transformer is a kind of neural network, and nearly all large language models are built on transformers.

That makes a lot of sense. So, another… I'm going to go almost back to the top with another basic question, and maybe this makes sense, maybe it doesn't, which is: can you explain the hierarchy of the different kinds of models and terms we're using here? Like, is the transformer architecture still… are we still in the world of neural networks? Where do LLMs fit into transformers? How does that whole thing look?

Yeah, that's actually a really good question for demystifying. And just before we got started with the recording, I was saying to you, basic questions like this are really good, because if you're a person who's immersed in this, you just take it for granted, right? You can mentally swap all the terms in your head. But if you're a new person, and especially a non-technical person coming to this world, you're like, are these different, are they the same, how do they fit together? This is actually a really good question. So transformers are an architecture.

Frank Rosenblatt's Mark I Perceptron, the first neural-network machine (shown publicly in 1960): a 400-photocell "eye" and weights stored in motor-driven potentiometers. From the operator's manual.
Frank Rosenblatt's Mark I Perceptron, the first neural-network machine (shown publicly in 1960): a 400-photocell "eye" and weights stored in motor-driven potentiometers. From the operator's manual.

They are a neural architecture. What a neural network actually is has evolved almost out of all recognition since the term was invented. Not quite, but almost. The term "neural networks," again, was invented in probably, I think, the '50s or '60s.29Fact-checkNot quite: Warren McCulloch and Walter Pitts described a model of a neural network back in 1943 — a "neuron" that fires when the sum of its inputs crosses a threshold. Frank Rosenblatt invented the first trainable network, the perceptron, in 1958. Wikipedia. I can't remember for sure. But at the time there was this big idea, it was called the connectionist idea of intelligence.30Connectionism — the view that intelligence emerges from many simple connected units, like neurons in the brain, rather than from explicit rules and symbols. The rival camp, symbolic AI, dominated the field for decades. People had looked at the neurobiology of the brain, and they're like, well, it's actually all these little units, they're connected to each other.

And they seem to fire when there's enough signal coming from the other places they're connected to; when there's enough voltage, it seems to fire. So let's make a computer that acts like that, and we'll call it a neural network, right? And then very smart people were like, well, how do we get these neural networks to understand things? We'll train them, which is that algorithm that I described before. That actually wasn't the first algorithm either. It took a long time to figure out how we actually train these things on something useful. Backpropagation,31Backpropagation — a fast way to compute the gradient for every weight in a multilayer network. Seppo Linnainmaa described the math in 1970, Paul Werbos proposed it for neural networks in 1974, and a 1986 Nature paper by David Rumelhart, Geoffrey Hinton and Ronald Williams made it famous. Wikipedia. which is the way everything is done now, was an original idea at the time. It was not at all obvious that that's what you should be doing.

I'm going to ask you to describe backpropagation now.

I mean, it was exactly that algorithm that I just described. You take a look at the output, you take the difference between the output and the input,32Fact-checkNot quite: the model's output is compared with the correct answer, not the input, and the gradients flow backward from the output to the input, not "back to the output." Anton misspoke; he described the algorithm correctly earlier, at 00:15:29. Backpropagation. you use that to construct a gradient, and then you flow the gradients backwards through the model, back to the output, adjusting the weights in the right direction along the way.

That's the high-level overview of what it is. Anyway, so today… those neural networks were relatively simple. Actually, I don't know if you're familiar with the AI winters.

General idea of: we get excited about something, it doesn't quite work, and then we have to go back to the drawing board.

And then funding gets pulled. Yeah, the first AI winter33The first AI winter — in 1969 Marvin Minsky and Seymour Papert proved in their book Perceptrons that a single-layer perceptron can't compute even exclusive-or (XOR), though multilayer networks can. Interest in neural networks faded, and in the 1970s DARPA cut AI funding, as did Britain after the Lighthill report (1973). Wikipedia. happened because somebody demonstrated that, in an extremely simple case, neural networks couldn't perform this particular logic task. And then, for whatever reason, the DOD was like, okay, we're going to pull funding from this. It can't do this simple thing after all this time, that's silly. When actually, even that paper that got published, "they can't do this," was like, no, no, no, simple ones can't do this. They were very explicit to mention the most simple ones can't do this.

But everyone blew it out of proportion, because, I mean, at the time also there weren't these huge advances that people had assumed would come. Anyway, so neural networks, that's what they used to be. They used to be this one very specific thing, but over time it's evolved into a family of things. And I would say that today a neural network requires you to have two things. It requires you to have connections which have weights. It requires you to have non-linearities.

So non-linearities are like: you have an input and the output, and it's a function where the output is not just the input times something plus something. It has to have some other function in between.34Non-linearity — without it, any stack of layers collapses into a single matrix multiplication that can describe nothing more complex than a straight line. The most popular one is ReLU: negative numbers become zero, positive ones pass through. That's a very rough definition. Someone is going to yell at me that I missed a bunch of stuff. I don't care. I know I did.

So basically anything that has those properties can fairly be called a neural network, because that actually turns out to be what you need. You need connections which have weights, and you need some non-linearities between them. And it turns out as well that, because that's all you need, we can make doing this stuff very computationally efficient, because it comes down to matrix multiplication, and matrix multiplication is something that we know how to do really well on computers, for lots of reasons. Anyway, so a transformer is a pretty advanced and relatively complex form of neural network. Actually, in some ways it's also very simple, which I know is a contradiction in terms, but maybe we'll get to that.

And a transformer is a type of neural network. So to go to your other point about large language models: most large language models today use variants of the transformer architecture, which is rooted in this paper that we're looking at, "Attention Is All You Need." This is the fundamental architecture for most large models, large language models at least, today. There's a new class of models for image generation which are working really well, called diffusion models.35Diffusion models learn to remove noise from an image step by step: they start from pure noise and "develop" a picture to match the prompt. DALL-E 2, Midjourney and Stable Diffusion ran on them in 2022. The two worlds have since merged: the diffusion transformer (DiT) paper came out in December 2022, and Stable Diffusion 3 and the video model Sora are built on it. Peebles, Xie, 2022. They're a little bit related in a very broad sense, but they're both neural networks, they're both large models.

Transformers are mostly for tasks where you have a sequence of tokens, right? You can think of a large language model as just a model that deals with sequences of tokens, and transformers are usually the architecture that makes large language models work. Something interesting as well, though, is that you shouldn't restrict your thinking about this to just this particular domain, because there's a thing called an image transformer,36Image transformer — the best known, the Vision Transformer (ViT), was described by Google in 2020 in "An Image is Worth 16x16 Words": the image is cut into 16-by-16-pixel squares, and each becomes a "word." arXiv. where what they do is they take an image and they tokenize it, they cut it into little pieces, and then they feed it into a transformer. And it turns out you can do image tasks with this thing that was originally meant for text, if you train it right and think about it. And that's another thing that I was talking about earlier: we're still exploring the capabilities of the models that we already have while continuing to innovate on the algorithms and architectures. It's just a super exciting time to be in this field.

06The encoder, box by box: embeddings, positions, attention

Anton walks through the left half of the figure: words become vectors, positions are added in, attention weighs the context, and adding back the input preserves information.

Figure 1 of "Attention Is All You Need." Encoder on the left, decoder on the right: the pink Embedding boxes turn tokens into vectors, the gray boxes are layers (N× — six of them), orange is attention, blue is feed-forward, and the yellow Add & Norm boxes add in the bypass connection.
Figure 1 of "Attention Is All You Need." Encoder on the left, decoder on the right: the pink Embedding boxes turn tokens into vectors, the gray boxes are layers (N× — six of them), orange is attention, blue is feed-forward, and the yellow Add & Norm boxes add in the bypass connection.

Yeah. So that's the basic architecture. I guess maybe the next place to go: there's a section, maybe I'll scroll to it, section three talks about the model architecture here. Yep, here it is. So I guess, one, can you explain what the model architecture looks like? Here it is graphically, for those of us who might not be able to follow that: what exactly is going on in here? And then, yeah, how much has changed in the past five years, or if it's just what's being built on top of it that's changed so much?

Yeah, so I'm going to start with the second question first, and then we'll get into the diagram. A lot of what's been innovative lately is mostly about making this more efficient, and understanding what it's actually doing, and testing it in different ways, and putting different things inside it. Basically, the core architecture is relatively unchanged. So that's a good place to go into what the core architecture actually is: what is this diagram that I'm looking at, which is the real question you were asking.

Basically, the core architecture in a transformer is this encoder-decoder pair.37Encoder and decoder — the paper's transformer translated, so it needed both halves: the encoder reads the source sentence, the decoder writes the translation. Later they were split: BERT (2018) is encoder-only, while GPT and nearly all of today's chatbots are decoder-only. So the left side of what you're looking at, the left column, basically is the encoder, and the right side is the decoder. And so it's a good idea to probably talk about what's actually being encoded.

So what's being encoded on the left is the input sequence. So you have your prompt, it's getting encoded. So that pink box first at the bottom says "Input Embedding.38Embedding — the list of numbers a token turns into. In the paper each token gets a vector of 512 numbers, and words with similar meanings get similar vectors. Storing embeddings is what Chroma later built its database around." So that is an operation which transforms words into numbers, basically, into vectors of numbers. So what that box will do is it will take your long string that's your input and transform it into a vector of numbers, where each number represents a token. So that transformation is already learned.

In this paper, it's already learned. You can also do it other ways. You can have a fixed thing that does it, but here it's learned. And I think in most cases these days the word embeddings are learned. There's another thing we can talk about, how the input embeddings actually… and you can do all kinds of neat tricks with them, but that's the basic.

So this part is when, if you're familiar with the GPT-3 Playground39Playground — OpenAI's web page where in 2022 you could try GPT-3 without code: type some text, press a button, and the model's continuation appears highlighted in green. screen, the regular text that I type at the top, before you see all the green highlighted stuff below, that's the input that we're talking about here?

The prompt that I'm writing.

That's right. That's right. And then it gets turned into numbers, a vector of numbers. And then the next thing that happens here is the positional encoding.40Positional encoding — in the paper, a set of sine waves of different frequencies that gives each position its own pattern of numbers. Today's models mostly use RoPE (2021), which "rotates" vectors by an angle that depends on position. This is actually a really important thing. This was something that I think is pretty important to the history of these things, because in a recurrent model like an LSTM, you don't need the position encoding.

The position encoding is implicit, because if you're on the nth step of the recurrence, you know you're talking about the nth position. Here, we've got the whole text at once. So we need to know what part of the text each word is actually in, as opposed to treating it as a collection of words, right? This is a problem that a lot of prior approaches in NLP had, where you just got a bag of words,41Bag of words — representing a text as a set of words and their counts, without order: to such a model "dog bites man" and "man bites dog" look almost the same. and then the machine translator would try to reconstruct something from that bag of words.

It doesn't really work. So you need the position encoding to keep the order, so that the network, the transformer, knows about the order the words came in from the input. And I won't go into the math, it's fairly straightforward. What it does is it creates another vector, and then it attaches that vector. That plus sign there just means they literally just glue it together:42Fact-checkNot quite: the positional encoding isn't glued onto the word vector but added to it element by element — both vectors are the same length, 512 numbers. It's the same "information-destroying" addition that amazes Anton in Add & Norm. The paper, section 3.5. this vector and then the position encoding, glue it together, feed it to the next layer.

All right, dumb question alert before you go. So does that positional encoding… is that part of the reason that it has this concept of position, that even long paragraphs feel more cohesive than the gobbledygook that came out before?

So its input, its requirement that it needs to figure out what's going on, also actually makes the output better.

Exactly. I mean, the thing that it needs to make the output better is to know what's going on. It's all about context. And, I'll get to attention in a minute, but what attention does for us is, every time you're trying to predict the next word, it knows where to go looking in the input to make the right prediction. So in that case, what you were saying about weights before is actually true. Attention weights the input appropriately in order to make a weighted prediction instead of a flat, equally distributed prediction. That's what attention does for us, right?

Anyway, so we have the position encoding, and now we get into the stack of encoder layers. So that gray box: there's actually, I think, six of them in this paper's architecture. Six is actually kind of arbitrarily chosen. I think they actually chose it so that it optimally fit in the GPU memory and you fully utilize the compute that they had.43Six layers — the paper doesn't say why six. It does say the base model trained for 12 hours on one machine with eight NVIDIA P100 GPUs, and the big model for 3.5 days.

ExplainerHow attention works

Attention answers one question: which words in the context should I look at to understand this word?

  1. Each token is turned into three vectors: a query ("what I'm looking for"), a key ("what I can offer") and a value ("what I'll pass on"). These come from three learned weight matrices multiplied by the token's vector.
  2. A token's query is compared with every token's key by a dot product: the better the match, the bigger the number.
  3. Softmax turns those numbers into shares that sum to one — the attention weights.
  4. The token's output is the sum of all tokens' values, weighted that way. In "The animal didn't cross the street because it was too tired," the word "it" puts the most weight on "animal."

Multi-head attention does this several times in parallel with different matrices: the paper has eight heads, and each learns to track something of its own, one the subject, another the neighboring words. All the comparisons are independent, so they're computed for the whole text at once — which is why transformers are so fast on GPUs.

So first we have this thing called a multi-head attention mechanism. So attention, like I mentioned, is this thing that allows you to weight your input appropriately for making a prediction. And a prediction here is literally… the inputs to attention are numbers, and the outputs are also numbers, right? It looks at different parts of the context, weights them differently, does a couple of matrix multiplies and a nonlinear piece, and then outputs something. And it's more complex than that, it's query-key-value stuff, but to get more detail on that you can read the paper in depth. But the important thing is, that's what an attention head does. It looks at how to weight the numbers together.

Anyway, so that's what attention is doing for you. And then you'll notice this other thing. So multi-head means there's a bunch of these things. It's not just one. If it was just one, it could only… imagine if you could only pay attention to one subject of a sentence in an entire paragraph, even though there might be multiple subjects and they might be doing different things in different parts of the paragraph, right? So what multi-head attention allows you to do is to weight things differently for different parts of the context, so you get richer and more information about that.

And I think in this paper they have… I just want to check how many attention heads they actually have. Here we go. It is in their architecture. Eight. So it has eight heads.44Eight heads — each token's vector of 512 numbers is split into eight parts of 64, and each attention head works on its own part. Now then, it has this other thing where it says "Add & Norm.45Add & Norm — a residual connection plus layer normalization. The bypass connection was invented for the ResNet image network (2015), which made it possible to train hundreds of layers; layer normalization (Ba, Kiros, Hinton, 2016) rescales a vector's numbers to mean 0 and spread 1." So you see how there's that… that's multi-headed attention, that's what that guy's doing. And then it's got this add and norm thing.

So what that allows you to do here is: okay, we're getting these values out of the attention heads, but we also want to keep what we had originally, right? So that we can keep propagating that information as well. So the way to think about it is, this layer has learned something, it figured something out about this context, something important. Maybe it successfully broke it down into important paragraphs or whatever. That's not really what it's doing, but conceptually. But we want later layers of the network to also have information about what we started with. So they can be like, oh yeah, we broke it down, and here's what's in there, so I'm going to figure out more stuff about it. So that's what this bypass and then this add and norm is.

So is it both building off of what happened when it figured out what the different paragraphs are or whatever, and going back to just the original as well at the same time, to make its own connections, and then maybe somehow comparing those things?

xattentionbypassnormx + attention(x)
Add & Norm: a sublayer's output is added to its own input and normalized, so the original information reaches deep layers.

Yep. It's keeping information about both. What actually blows my mind about this is the way that it combines them is an addition and then a norm. A norm is basically just constraining the values that can be in the vector to be smaller than a certain amount. What blows my mind is addition, when you think about it. It's an information-destroying operation. So what I mean by that is, if I have the number five, I don't know if you added one and four to get it or if you added three and two, right? I can't know. But it turns out that this is enough to propagate information deeply into the network, to just do that addition with the original input. It blows my mind that this works. It freaks me out every time I remember this. I hate it, but it works.

Is there like a best explanation for why it works?

Probably the best explanation is it preserves enough information. It propagates enough information. One way you could do this, if you wanted to really preserve all the information, is you could concatenate the input vector again. But then what happens is each of your layers gets wider and wider and wider. They need more compute resources, you can't do it in parallel as easily anymore. So it turns out that this is enough, and given that it's enough, we probably won't do the other things.

07The Bitter Lesson: are data and scale enough?

Simple, scalable methods beat clever ones, but Anton doubts transformers plus data will be enough, because text is about to run out.

This is actually one of the problems as well. It's difficult and not necessarily rewarding to experiment with little architecture tricks. So there's this paper which was out a while ago called "The Bitter Lesson,46"The Bitter Lesson" — a short essay by Richard Sutton, a founder of reinforcement learning, from March 13, 2019: over 70 years of AI, general methods that grow with computation have beaten clever approaches with built-in human knowledge again and again. incompleteideas.net." which basically said: listen, all this time we've been spending on fancy architectures and trying to get them to encode things that we as humans know about… No, it doesn't matter. Make it simple, feed it a lot of data. That's what matters. And so that's one of the reasons why, if the simple thing works, we just let it work.

Did that paper come before or after this paper? Because I know one of the things that I hear, as someone who doesn't spend my days reading this, is like, whoa, the amazing thing here is that you can just feed it all this data and emergent things start happening. So is that built on top of transformers, or was that a separate thing just about architecture?

It came after. It came after, I just looked it up. It came in 2019; this paper's from 2017. It's like two camps,47Two camps — the loudest critic of betting on scale alone is the psychologist Gary Marcus, who published "Deep Learning Is Hitting a Wall" in March 2022; scaling advocates answered that each new model kept breaking records. right? There's a group of researchers who say data and scale is all you need, although we're starting to run into the limits of that. And there's another group of people who are like, no, we need to put more information that we know about the world into these models to get them to do more useful things. And "The Bitter Lesson" was a publication in favor of the idea that all you need is data and scale, and so we do simple things and it'll just work.

Which camp are you in? Just so we can piss off half of the people who are watching.

Yeah, you're definitely gonna… people are gonna come after me if I give my opinion, which I don't mind, actually. So I'm in the camp that… there's this other great thing called the Chinchilla scaling laws.48Chinchilla — DeepMind's model from the paper "Training Compute-Optimal Large Language Models" (March 2022). It's the subject of the series' second episode. arXiv. We won't go into them here, but I think that would actually be a really interesting one for our next episode, which we might go into.

I've seen Chinchilla around, so I would love to learn more.

ExplainerWill we run out of data?

The Chinchilla laws. In 2022 DeepMind trained more than 400 models and worked out how to split a fixed compute budget between model size and data: grow both in equal proportion, about 20 tokens of text for every parameter. By that rule nearly all the giants of the day — GPT-3, Gopher, Megatron-Turing NLG — were undertrained: too many parameters, too little data. Chinchilla, with 70 billion parameters trained on 1.4 trillion tokens, beat Gopher, which had four times as many parameters.

Hence Anton's worry. If a good model needs 20 times more tokens than parameters, high-quality text on the internet will run out soon. In 2022 researchers at Epoch AI estimated that the stock of high-quality language data could be exhausted as early as 2026; their refined 2024 estimate put the exhaustion of all public text, about 300 trillion tokens, between 2026 and 2032.

What happened next. Labs began training models far longer than Chinchilla recommends (the 8-billion-parameter Llama 3 saw 15 trillion tokens), cleaning and repeating data, generating synthetic data and training models to reason with reinforcement learning. In December 2024 Ilya Sutskever told NeurIPS that "pre-training as we know it will end": data is "the fossil fuel of AI," and there's no more of it coming.

Yeah, I mean, Chinchilla is basically an optimally trained large model, optimal in certain ways. And so the Chinchilla scaling laws say: here is the returns to more data. They wrote an equation down that says, if you do more data, this is how many more parameters you need in your model, how many more weights you need in your model to actually get any use out of it. Otherwise it's worthless, the compute isn't worth the time. And what that says is, if you go one step further and you compute how much data we actually have at internet scale, we're pretty close to saturating already. So I think we're gonna have to get clever.

But I've changed my opinion on a bunch of things to do with AI over the course of the year, and one of them is the power of text modeling, actually, what it actually gives you. And so yeah, I think that's an interesting conversation to have. I lean more towards "we'll have to get clever." Transformers are not the end, basically, is what I believe.49Not yet: at the end of 2026 the leading language models are still transformers underneath, if refined ones — with mixture-of-experts, new positional encodings and hybrids with state-space models like Mamba. Transformers with more data are not the end. And that word that you said, "emergent," I think that's a really tricky word.

I think "emergent" just means "surprising"50Emergence — in 2022 Google showed that some abilities appear in models abruptly, past a certain size. In 2023 Stanford researchers objected much as Anton does: the jumps are largely an artifact of the metrics, and with a smooth measure quality improves smoothly. That paper won an Outstanding Paper award at NeurIPS 2023. Schaeffer et al.. in a lot of cases. I'm sure we'll find surprising things, and we continue to find surprising things about GPT and other large models. So I'm ready to be surprised. But the thing that "emergent" also implicitly often means is: we're gonna just feed it more data and it'll grow new capabilities it didn't already have when it had a little bit less data. I don't believe that, but I do believe that it will continue to do surprising things we haven't discovered yet.

That's interesting. And maybe let's just put a pin in that piece, because I want to talk about it at the end. Because I think in that Andrej Karpathy podcast, he was like, yeah, I think transformers, we can ride these things for a very long time and they'll do a bunch more. And it sounds like maybe you think that new architectures are needed. So we should keep it…

I think we haven't exhausted them. Yeah, I think we haven't exhausted them for sure. Like I said, they have capabilities. We just keep finding out more capabilities they have. The sequential reasoning thing was mind-blowing: when you just ask it to reason step by step, it works better. And then there's a recent paper which is "Large Language Models Can Self-Improve,51Fact-checkNot quite: in the Google paper (October 2022) the model doesn't critique its output. It solves problems step by step many times, picks the most consistent answers by majority vote and is fine-tuned on them — no labeled data, but the weights do change. Self-critique of the kind Anton describes came in 2023 with work like Self-Refine and Reflexion. Huang et al., 2022." which is like, when you ask it to be critical of its own output, it performs better. It's wild, right? And it's already in there, without any extra data. It just already does it.

That's amazing. Will it do a good job criticizing my work? Will it do better criticizing what I put in than creating something new itself?

I don't know, give it a shot, see how you feel. Cool. You've got OpenAI credits, right?

They just give those to you, yeah.

And I started paying, but my bill for the last two weeks, I think, was 82 cents.52OpenAI credits — new API users then got $18 to spend over three months. From September 1, 2022, the largest model, Davinci, cost 2 cents per thousand tokens, so 82 cents is about 40,000 tokens, or some thirty thousand words. The Decoder. So okay, great. It's worthwhile. We got it.

08The decoder: writing text one token at a time

A transformer only ever predicts the next token, and masking and attention to the encoder decide what it looks at while doing so.

Yeah. Yeah, so play with it. Anyway, back to this guy, right? So we're up to the blue box there, the feed-forward piece.53Feed-forward layer — in the paper, two matrices with a ReLU non-linearity between them: the 512-number vector is stretched to 2,048 and squeezed back. Researchers later found that these layers are where a model stores much of the factual knowledge it learns. Feed-forward here is actually the closest thing to the classical neural network in this entire architecture. So it's basically a bunch of little guys called neurons, which have that non-linear, what's called an activation function, inside of them.

And they take the stuff that comes out of that previous piece, the add and norm, and then they multiply each element by the weights and then apply a non-linearity to that at the end. So you just get new numbers out. We know we need this non-linearity, basically. And then again, to make sure that we preserve information before we apply that non-linearity, we've got this connection that goes around and then adds and norms it again. So that's one layer. Everything in that gray box is one layer of the encoder.

It's got six of those in the reference architecture. And again, it sounds complex, but if you've been in the field for a while, this is actually surprisingly simple. This is relatively simple, which is one of the marvels of why it works so great. Generally speaking, ML people, and I don't know, technical people in general, are looking for simple things that work surprisingly well rather than elegantly constructed complex things. At least that's my aesthetic preference, and transformers are one of those things. Because this is why the "all you need" is important in the paper title. It's like, this simple thing is actually totally enough. You don't need to do all this other fancy stuff you've been trying to build on top of it. This is fine.

I love the title. It's not what I expect when I read a research paper: "Attention Is All You Need." It's more of a Not Boring54Not Boring — Packy's newsletter on tech and strategy, known for long posts with catchy headlines. post headline. It's catchy.

I got to give you another paper. There's a paper in computer vision called YOLO,55YOLO — an object detector by Joseph Redmon and co-authors (2015) that finds every object in a frame in one pass of the network. The "madman" paper is the YOLOv3 report (2018), which opens: "I didn't do a whole lot of research this year. Spent a lot of time on Twitter." In 2020 Redmon quit computer vision over military uses of his work. arXiv. which is already great, right? Stands for "You Only Look Once." But the paper is written by an absolute madman, and I think you'd get a kick out of just reading it, because it's… yeah, you know, we'll get to that. But yeah, this one is actually really formally written, but has a great title. Sometimes people get a little too clever with their titles and it's a little bit cringe, but this one is good.

Yeah, it's just… anyway.

Yeah, six layers, six of these guys. So basically it takes the output of the previous layer, does all that computation, and then outputs it.

ExplainerHow a transformer writes text

A language model doesn't write its answer all at once — each time it predicts one next token.

  1. The model's output isn't a word but a probability distribution over the whole vocabulary: "cat" 31%, "dog" 12% and so on for tens of thousands of tokens.
  2. A token is picked from the distribution: the most likely one (greedy), a random one among the K most likely (top-K), or a random one with probabilities flattened or sharpened by temperature.
  3. The chosen token is appended to the text and the whole thing is fed back in — that's what autoregressive means: the model builds on its own previous outputs.
  4. This repeats until the model emits the special "end of text" token or hits the length limit.

The model can't go back and rewrite a token it has chosen. So the quality of an answer depends heavily on how tokens are picked — and that's why "reasoning" models later appeared, which first get to write out a draft of their reasoning.

So here's how we start getting to the decoder side. So each of those output layers feeds into this decoder layer. And this is what's called autoregressive. So what a transformer does, all it ever does, is predict the next token. Or actually, what it does is it gives you a distribution over the likelihood of the next token. It says, you know, this is the probability that it's this, and you can select the most probable one and then feed it back in, for example, right? So what it means by autoregressive is it takes the input, and then it takes its own output sequentially, and then uses that to make the next prediction. That's what's meant by autoregressive.

And when you say it's a distribution, does it keep any of the… not the most probable, but the other ones, in short-term memory or something, to say, actually, we got four words down and the other one was right? Oh, you mean like, can it branch and go back? Can it go back and be like, actually, now that we've gone further down this path, no, the second most probable was right?

No, not in this architecture. But what you can do, of course, is just select the top K56Top-K — the model takes the K most likely next tokens and picks among them. Following several best continuations at once is called beam search; the paper's authors used it for translation. and have it keep predicting off of those ones, and see if you get somewhere different. And so when you see, I don't know, GPT, or, I don't know if you use Copilot57GitHub Copilot — an AI coding assistant from GitHub and OpenAI that completes code right in the editor. It launched in June 2021 and became a paid product in June 2022. at all, but when it makes multiple predictions, that's what it's doing. It's selecting lower down the probability tree and then making more predictions off of that token. But this is autoregressive, so for simplicity's purpose we're going to say we're just going to take the most likely prediction next.

Now you'll notice that this also looks a lot like the input. It's got the position encoding. So it has to remember where in the output string it actually predicted the thing that it's doing. And so when it makes the first prediction, it's got one token and then basically nothing. And then when it makes the next prediction, it shifts that one spot to the right, so it keeps the position encoding and predicts the next one. It's like, oh, if this one was in the first position, then what is my prediction for the second position?

It keeps that position encoding, and it feeds it back in. So you see at the top here it says "Output Probabilities." Yeah, so from those output probabilities, which is the distribution that I mentioned, it selects the K most probable, or the most probable one, to make its next prediction, and it gets fed into this "Outputs" input at the bottom in the decoder. So anyway, this is the decoder stack. So you'll notice that…

Sorry, one more question on the position, which is: when it gets to the end of a sentence and adds a period, does it have any concept of a sentence? You said on the other side that it breaks down paragraphs or sentences. How does it know where it's getting to the end of a cohesive thing?

Yeah. So there's a special character called "end of text,58End of text — in GPT-2 and GPT-3, the special token <|endoftext|>, number 50,256. In training it separates documents; in generation, once the model emits it, it stops." which it encodes as if it was a word, right? It's literally a special number representing end of text. And so when you write a prompt, you are implicitly putting end of text at the end. You're implicitly putting that character at the end. And it predicts those characters just like any other ones, right? And it's just like, okay, whoever's reading the output, the program reading the output of the transformer, sees end of text and is like, okay, stop, don't run anymore, just stop. Yeah. And I think, in general, once it sees end of text in its output, what's called its output context, it will just keep predicting end of text. It will very heavily attend to seeing end of text.

Yeah. The position encoding is just about what place you're in, not if you've ended the sentence or not.

Cool. Makes sense.

positions it may look at1234512345← the future is maskedposition 4 sees 1–4Each row is the position being predicted.
The decoder's mask: position 4 sees positions 1–4 but none after them, so the model can't peek at words it still has to predict.

Yeah. So again, taking a look here on the right, you'll see that a lot of this is very, very similar. You've got the position encoding, like you mentioned, you've got multi-headed attention. The thing about this is it's masked.59The mask in the paper matters mainly during training: the decoder sees the whole correct translation at once, and the mask keeps each position from peeking at the words it is supposed to learn to predict. So what masked means is: don't pay attention to stuff that is in the future. Because it still applies attention, so, you know, say you have 2,056 tokens60Context — GPT-3's was 2,048 tokens for prompt and answer together. By 2025 leading models had reached a million tokens. in your input and output, it still can pay attention to all that white space, but you don't want it to, so you mask it out. You only want it to pay attention to the stuff that it's already predicted, not garbage. So you mask that out when you…

And then, is the white space just a number itself? Is it already a token, but it's an empty token?

So the white space, the way that gets treated varies, basically, but you can think of it like the white space is padded with however many extra tokens you need to fill out the total amount. So if you have one prediction and 2,056 total tokens in your context, you have 2,055 of whatever the white space token is. Yeah, so mask just means: don't look at anything that is in the empty part, the stuff you haven't predicted yet, leave that alone. And so that mask gets rolled back as you predict more stuff. And then again, there's this bypass, the add and norm. And then again, there's this bypass to the next multi-headed attention.

So this is different from the encoder layer. There's this extra multi-headed attention and add and norm thing, right? So what that's doing is basically taking input from the encoder layer, the corresponding encoder layer.61Fact-checkNot quite: in the paper every decoder layer looks at the output of the last, sixth encoder layer, not its numbered counterpart; in Figure 1 the arrow from the encoder goes to every decoder layer. The paper, section 3.2.3. So the first encoder layer goes into the first decoder layer. Information is flowing now from the encoder side to the decoder side. And this multi-headed attention layer in the decoder is looking at: what stuff that I'm getting now from this stage in the encoder is actually relevant, given what I've already seen in my output?

So it's now paying attention to a lot of different stuff. It's getting a lot of different information from a lot of different parts of the context, and it's learning at each step: what parts of the context do I need to be paying attention to, given what I've already predicted? That's another way of thinking about this. And then, yeah, you can see that from here it's pretty much the same thing. You've got the feed-forward layer, which I described before, with the skip thing, and then you add and norm to, again, preserve that information, let as much information propagate as late as possible.

And then once you've done this stack, you've got output finally. And the output is a linear layer, which is just a set of weights where it multiplies every element of the vector by some number, and then you have softmax.62Softmax — a function that turns any set of numbers into probabilities: all become positive, they sum to one, and the largest gets the biggest share. By itself it doesn't choose anything, as Anton immediately corrects himself. And softmax is basically just: choose the highest probability, and that gives you the output probabilities. Yeah, it's just: turn that number that's coming out of the linear layer into probabilities. And then your outputs are probabilities, and then you select. And the probabilities are for every token that I know about, every token in my vocabulary,63Vocabulary — the paper's model had about 37,000 tokens for English and German combined: words are split into pieces, so the token count doesn't grow with the number of words in a language. which is everything that's in my training data, it's all tokenized, and then there's a giant thing: what is the probability that the next token could be that token? It constructs a probability distribution over that.

So it does that for… I don't know how many words there are in the English language, times that many languages, whatever. There's that many tokens, and for each one it's running the full distribution on all of them?

Yeah, it's basically saying, you know, find the likelihood of whatever the next token is. And the thing is, we can compute that efficiently. That's entirely parallelizable, because you can imagine it as: if I want the probability for a given token, that's completely independent at this step from the probability for another token. So I can run it completely in parallel. I can have a lot of them, sure, but I have a lot of GPUs, so it's fine. Or even a single GPU can do a lot of operations like this linear and softmax all at once.

09Why GPT-3 repeats itself, and how to give it a style

Sameness comes from training, data and always taking the likeliest token, and style comes from the prompt or from fine-tuning.

So fascinating. A question, something that I've noticed as I've played more with GPT-3, and I wonder if it just illuminates anything about the model and the architecture itself, is that it structures a lot of paragraphs, if I'm asking for an essay, in a very similar way. And then it also ends the arguments in a very similar way. And a lot of it's probably because humans love to talk about how important whatever they've done is, but a lot of times it'll be like, "And so therefore this thing is really important because of this," and that ends up happening a lot more than I would have expected. Two things: one, it ending itself by calling the thing important, but then two, it'll say, "And a blah blah blah does this because of blah blah blah, and a blah blah blah does this because of…" and it's very repetitive. Is there a reason for that, that the… described, explained by this?

Are you playing with the noise parameter at all64The noise parameter — in the Playground it's called Temperature. At zero the model always takes the most likely token and often repeats itself; at higher values the choice gets more and more random. when you're playing with the Playground? Yeah, play around a little bit with the noise parameter. So the noise parameter is basically adding a little bit of randomness about which token actually gets predicted. So like I said, there's a probability distribution, right? It doesn't have to predict the most likely one. It can roll the dice in proportion to what the probabilities are, to a greater or lesser extent, and decide: no, actually, I know this is the most likely one, but I actually rolled the dice and got this other one, so we're going to stick that in and see where I go, right? So if you play with the noise parameter, max out the noise…

Does it do that for, like, each word?

It gets weird. Yeah, it's pretty weird. It gets sidetracked really easily if you do that. It starts talking about other stuff. It's pretty fun. You can get it to be pretty unhinged sometimes, which I really enjoy. Yeah, I like taunting the AI, which is why they're going to come for me first.

I was gonna say, yeah, you're in trouble.

Boston Dynamics introduces its four-legged robot Spot and kicks it to show off its balance (2015)

Yeah, I mean, I'm definitely the guy who kicks the Boston Dynamics dog, because I want to see if it can stand up.

You're in real trouble then, yeah.

But yeah, so it will settle into common patterns, and that is a result of both the training process and the training data. So there's actually a bunch of different ways to train transformers, right? I think the way that GPT is trained, if I remember correctly, it's trained exclusively on completions, which means it sees an input, and then it's given part of the output, and then it's expected to predict the rest of the output, and that's how you compute the loss. And then you move that piece of text further and further to the right, so it has to predict it no matter where you are in the text, right?

But there's a bunch of other ways to do it. People are playing with these now, they've played with them before, with big models like BERT65BERT — Google's model (2018), trained to guess hidden words: 15% of tokens in a text were masked, and the model restored them from the words on both sides. It gave Google Search a big jump in understanding queries. or PaLM,66PaLM — Google's 540-billion-parameter language model (April 2022). It was trained like GPT, to predict the next token; filling in missing spans was the training task of T5 (2019) and of U-PaLM, released in October 2022. where it's like, okay, well, I'm gonna randomly delete words and see if you do a good job of filling them in, or I'm gonna delete contiguous pieces in the middle instead and see how you do with that. And there's other things like fine-tuning, like InstructGPT.67InstructGPT — a version of GPT-3 that OpenAI fine-tuned in January 2022 to follow instructions, using human-written examples and human ratings of answers (RLHF). OpenAI called ChatGPT, released three weeks after this recording, a "sibling model to InstructGPT." Ouyang et al., 2022. So fine-tuning is a really common thing. It's really important. It's one of the things Chroma helps with, with large models: this is a great general model for all human text, right?

But that means it's not particularly good at any specific task. So if you have something like InstructGPT, where you tell GPT what you want and it does it, that's a specific subset of all language and all text. And so you fine-tune your model to behave more in that particular way by basically showing it more of the stuff that you want. But yeah, you can do that in what's called a zero-shot fashion,68Zero-shot — the task is stated in words, with no examples shown. The term took hold after the GPT-3 paper "Language Models are Few-Shot Learners" (2020). It's usually called in-context learning rather than fine-tuning: the model's weights don't change. which is when you… prompt engineering is also called zero-shot, zero-shot fine-tuning, where you say, "Write this in my voice," or, "Write this like Elon Musk would write it." That's like fine-tuning, because you're asking it to not just write this essay, but write it like Elon Musk would write this essay.

Yeah. So that's zero-shot fine-tuning, but there's other things you can do which are more like a traditional training process to fine-tune the model. And that will constrain it in the things that it outputs. The other thing to remember is, a lot of the time there is content moderation69Moderation at OpenAI meant two things: models were fine-tuned to refuse harmful requests, and in August 2022 the company opened a separate Moderation classifier that flags text for violence, hate and other banned content. going on behind the scenes, where it's already been fine-tuned or trained in a particular way so as to avoid unhappy types of output that OpenAI or other companies might not really want their models to do.

Yeah, that seems fair. So when I'm telling it to write like Elon Musk, I guess it's another good thing to dig in on, to understand what's happening better: is it all happening in this architecture here, or is something in the background? Really? So it's not just saying, like, we're just gonna look at any Elon stuff?

So yes and no. So that's the thing about attention, right? It will attend to the fact that you said Elon Musk, and that will weight its predictions. It'll go through this entire stack that we described, and it will be like, okay, in some ways I'm gonna change now my probabilities of completion, because I'm attending to the fact that you said Elon Musk. And the other thing that used to happen with the first version of GPT-3: you would ask it to do something, but it would just describe the thing, it wouldn't actually do it. You could say, "Write blah, blah, blah," and it would just describe the thing that you asked for.

It wouldn't actually do it. But InstructGPT is much better at actually doing the task. And that's because InstructGPT is fine-tuned to basically attend to what you're asking it to do more than the thing itself, the subject. And again, that's a gross simplification people are gonna yell at me for, but again, I don't care.

And so, I guess the last one on this particular point: if I brought my own model, right? I said, here's… I'm gonna dump in all of my journal entries that I've written, and all the private stuff on my computer and whatever, and I'm gonna marry it with this big… what happens there? Does my stuff just get dumped in, and it knows that it's mine, and so it weights… what happens?

Yeah, so that's a good description of a way to do fine-tuning. You can freeze most of the model and then retrain some parts of it70Fine-tuning part of a model — since 2021 the popular method has been LoRA, from Microsoft: the original weights are frozen and only small add-on matrices, thousands of times smaller than the model, are trained. Hu et al., 2021. to be more responsive to Packy-type writing. Or you can do another thing, which is you stick a classifier on the end of this, and you make it make tons and tons of predictions, and then you filter out only the ones that are like you. That's another way to do it.

One thing that's really cool about transformer models is they… at least for English. One of the big problems right now is we haven't really trained them well enough on other languages.71Other languages — 93% of the words in GPT-3's training data were English. GPT-3 data statistics. It's a big deal, except for the translation tasks. So we don't really know some of their limitations as well in other languages. Like, okay, great, English tasks, but is this equally good if the whole thing is running in German or in Chinese? We don't know.

One of the big open questions right now is how do we evaluate how good these models actually are? We're kind of saturating all our benchmarks72Saturated benchmarks — in January 2021 models beat the human baseline on the SuperGLUE suite, and later hit the ceiling on its successors too. In 2025 came Humanity's Last Exam, 2,500 expert-written questions on which models initially scored under 10%. right now. We don't know if it's good or not. And then people come along and demonstrate some tasks that they're absolutely horrible at, which means that we've got bad evaluations right now. And the other thing is, because these models are text, and it's about humans interacting with the text, as opposed to the model interacting with the real world, humans will fill in the gaps.73Filling in the gaps — known as the ELIZA effect, after Joseph Weizenbaum's 1966 program that answered with templates like a psychotherapist. Many users sincerely believed it understood them. You will let the model get away with nonsense that you might not even notice. Because when you're talking to another person, right, if they have small flaws in their speech, or they didn't quite express themselves clearly, you can tell what they're getting at.

We're designed as humans to error-correct, right? So we're very lenient towards the model as well. We're like, oh no, I get what it's saying, it's okay. And when you sit down and think through it critically and analytically, it's almost gibberish sometimes. Yeah, that was a big digression, but I think it's important.

Yeah, but it's the same with fortune tellers too, or whatever, where you're like, oh my God, that is exactly… you know, I am gonna marry the person that I love. And so you're looking for reasons that it's right.

Yeah, it's the Barnum effect,74The Barnum effect — people take generic statements that fit almost anyone as an accurate description of their personality. In 1948 the psychologist Bertram Forer gave students the same "personal" profile, and they rated its accuracy 4.26 out of 5 on average. It's named after the showman P. T. Barnum. right? You tell people what they want to hear, and then they don't really care if it's right or not.

Yeah. Anyway. We're learning more about ourselves through this whole process.

Actually, I think that's one of the most fascinating things about this whole thing. We are going to learn a lot more about how people actually think by building these things and then having people interact with them, because they're pretty good mimics at this point. And I think that's actually really, really interesting. I think we're going to learn more about what intelligence actually is… but I hate that, because intelligence is this fuzzy word. I think more of what's going to happen is we're gonna nail down what we mean by intelligence a little bit more over time, hopefully, by playing with these things. Anyway, yeah, fine-tuning on Packy output can be done in a bunch of different ways, is the short version to the question you actually asked.

10What humans do while a model trains

Humans pick the data and the architecture, a program finds the weights, the hard engineering is surviving the failure of thousands of GPUs, and the real limit is data, not money.

Fair. So on training, and this is another one of those very big, dumb, general questions, and you've addressed a little bit of it before, but we hear about model training all of the time, and training data, and all of the high level… And maybe we'll structure this the same way as before. What is training? When you're talking about training a model, what are you doing? And then how does it change with transformers?

Yeah, those are really good questions. So again, training a model is just updating the model's weights based on the difference between what it predicted and what you wanted it to predict, based on what it output and what you wanted it to output.

I think one of the things that's hard for me to grasp on this is, is this a human going in and, I mean, not adjusting…

So what's the human doing? And then what's… yeah?

The human basically selects the data, one way or another. It selects the data for the model, selects the model architecture. So it says, I'm gonna train a transformer, and I'm gonna train it on, here, the WMT 2014 English-German data set.75WMT 2014 — an annual machine translation competition. Its 2014 English-German data set has about 4.5 million sentence pairs; it's what the paper tested the transformer on. That's what the human does. And then feeds it into a program, and the program trains the model.

And what the program does is it basically looks, like I said, at the output of the model, compares it to the desired output, computes a number. It's called the loss. And then it computes the derivative of that number with respect to change in the weights, and then it changes the weights in the right direction. It's looking for an optimal set of weights that will give the best possible prediction given the input data. That's what it's basically doing. There's a lot of subtlety and a lot of different ways of setting that up, but that's the basic idea. Compute the difference between what you want and what you got, then compute a gradient, which is basically the direction and amount to change each weight in your model by, and then apply that change, and then do it again, and then just keep doing it until you're getting sick of it, basically.

And does a human do anything at this point? Or do you say, "That output is not what I wanted, the loss is too high, here's more or different data, because I need to do something different here"? Or is the human done once you've fed the initial steps in?

So I'm glad you brought that up, because Chroma does exactly that part. They select what data is optimal for the task that you want your model to perform, or the things you actually want it to do. We help the human figure out what data is actually needed next time around, or to fine-tune your model, or, in the case of large models, it's mostly about fine-tuning or preparing data sets or integrating new sources of data. But during the training process itself, most of what you do is sit there and watch your graphs and make sure it's not doing anything catastrophic. And you probably want to be paying attention to… so when you're training these very, very large models, one interesting thing that happens is you have so many GPUs running for so long that failure rates on their components are actually significant.

Your average person who owns a gaming box, a 3090 Ti,76GeForce RTX 3090 Ti — then NVIDIA's most powerful gaming GPU, released in March 2022 at $1,999. if they're lucky, they'll never see that GPU fail over the lifetime of the GPU. If you're training GPT-3, you have thousands or near thousands of GPUs running constantly;77Thousands of GPUs — GPT-3 was trained on NVIDIA V100 GPUs in a Microsoft cluster; in May 2020 Microsoft said it had built OpenAI a supercomputer with 10,000 GPUs. you will see failures. So one of the things you have to do is make this training loop robust to those, because imagine you've almost finished, 99% done, and one of your GPUs just burns out. You don't want to start again, right? So there's a lot of subtlety and there's a lot of engineering that goes into optimizing and making that process robust for these large models.

But again, it's automatic. It's so much data that it's physically impossible for humans to go look at all of it. We just can't. If you sat down thousands of people for probably years, you probably wouldn't get to see everything in the data set. I actually probably should do that napkin math. I'd be curious about how many people we would need to look through the entire GPT-3 training set in a year. Like, how many people would we need to do that? I should sit down and figure that out. It's probably what all of humanity would be doing.78Fact-checkExaggerated: GPT-3 was trained on 300 billion tokens, about 225 billion words. A person reads roughly 250 words a minute; at 2,000 working hours a year that's 30 million words. So about 7,500 people could read the whole set in a year — not all of humanity. GPT-3 paper. We may need to increase the population. But yeah.

Yeah. I guess two small things there. So the one that we didn't pick up is before and after. And then two, I know this is a basic one, but what GPUs are, and why GPUs instead of CPUs for machine learning.

Great, great. Yeah, those are really good questions. So a GPU is nominally a graphics processing unit. You know, if you're my age, you used to call them video cards. Yeah, what these guys can do is tons and tons and tons of basically multiplications and additions in parallel, very, very fast. That's all they do. And it turns out they were invented for 3D-accelerating games, because most of 3D graphics is about multiplying and adding stuff together. It's exactly those matrix multiplications times vectors of numbers that we talked about. Turns out super useful for machine learning. NVIDIA got really, really lucky with that.79NVIDIA's luck — by 2026 it had become the main business: on October 29, 2025, NVIDIA became the first company worth more than $5 trillion, almost entirely thanks to AI chips.

Imagine if machine learning needed something else. But no, turns out it's exactly right. So it's actually kind of interesting: one of the first uses for GPUs outside of gaming was actually with the hedge fund people, because they needed massively parallel streams of data processed as fast as possible. So they coded… they used to be called shaders, they're called kernels now.80Shaders and kernels — in the early 2000s researchers computed on GPUs by disguising math as graphics, through shaders. In 2007 NVIDIA released CUDA, in which GPU programs — "kernels" — are written in almost ordinary C. Among the first commercial users were banks and funds pricing derivatives with Monte Carlo methods on GPUs. They coded these little programs that run inside the GPU, but not to draw polygons. They just made them compute whatever their models were for the hedge funds. And then that leaked into AI, where we realized that, well, what we're really doing here is tons of matrix multiplications, and then applying some function, and then doing an addition.

GPUs are great for that. They can do it massively parallel. So your CPU might have, I don't know, eight cores, right? GPU: hundreds of cores, thousands of cores on the big ones,81Thousands of cores — the RTX 3090 Ti has 10,752 CUDA cores. Each is far simpler than a CPU core, but together they perform tens of trillions of operations a second. all doing additions and matrix multiplications in parallel, because a lot of the stuff that this thing does is completely parallelizable, right?

And so another thing, and we spoke about this at the start, but another thing that the transformer architecture does better than those recurrent network architectures is utilize more of the GPU for more of the time. It's possible to push more and more computations through it, which means that, generally speaking, as a rule of thumb, you can train on larger amounts of data more efficiently. And the idea is that having more data is better for performance.

And are we getting to the limits of that at this point here, or do the GPUs still have juice to squeeze?

No, I think our limit actually is not compute. People say, "Oh, GPT's so expensive to train, it costs $6 million.82Training GPT-3 in the cloud in 2020 was estimated at about $4.6 million (Lambda Labs). Anton's conclusion that compute isn't the limit didn't hold: training GPT-4 cost more than $100 million, according to Sam Altman, and in January 2025 OpenAI and partners announced Stargate, up to $500 billion for data centers. Wired." $6 million is nothing for a capability like this. You and I both know people with $6 million in their couch cushions. So it's just not a large amount of money. So we're not really compute-limited.

I think we're starting to saturate our data. I think a lot of people would agree that we're starting to saturate on text data. And I think that's actually a really good topic for the next one. I want to talk about the Chinchilla scaling laws, because I think they are the first things that we have that speak at least something to the possible limitations of doing things the way that we're doing. And we'll see.

All right, so that's a very good teaser. Yeah, let's do it. Is there anything that we haven't hit? The rest is really just results and conclusion. Results: it worked really, really well, outperformed previous models.83The results — on WMT 2014 English-German, the big transformer scored 28.4 BLEU, more than 2 points above the previous record, and 41.8 on English-French. And training cost a fraction of what the previous best models did.

11Explainpaper and the paper in two sentences

Read the paper with Explainpaper’s help, and remember it as a simple, fast model on which nearly everything since has been built.

Yeah, so it's really fun to talk about this. And again, the paper's really information-dense, really interesting, highly recommend reading it. If you don't have an especially technical background, my friend Aman built this thing, Explainpaper.84Explainpaper — a GPT-3 tool by Aman Jha and Jade Asmus (2022): upload a research paper, highlight a confusing passage and get a plain-language explanation. The Decoder. I think you've been using it as well? Yes, it's awesome. Has it helped you?

I mean, that's how I read through this paper the first time. And there's spots where there were fairly mathematical sentences that I highlighted. And so for those of you watching, the way that Explainpaper works is you have the paper. I think they started with just a few when I first tried it. Now you can put in any arbitrary paper.

It started with this paper. It started with this paper.

It started with this paper, which is the foundation again. And you can highlight the different sections in it. It'll explain what's going on in plain English. And by plain English, I don't mean, you know, something also complicated. It'll be like: this is, in a quick sentence, kind of what's happening, in a way that you can understand, and occasionally why that's important. It was shocking to me how good the explanations were. And then you can ask it further questions of the text.

So Explainpaper, highly recommend. It's just explainpaper.com, right?

Yeah, explainpaper.com. We should put that up on the screen.

Yeah, but it's super cool. I'm actually using it as well, even as somebody who has technical depth in this; I find it really helpful. And the way that I find it helpful is understanding why the thing the author is saying is important, and linking it back to other things. Like, how does this link into the broad web? That's what I've been finding it useful for.

Yeah. Maybe we really want that for the whole internet.

Yeah, I mean, kind of that's what Genius85Genius — the site that grew out of Rap Genius (2009), where users annotated rap lyrics line by line. In 2014 it became just Genius and set out to "annotate the world": its web annotator let people leave notes in the margins of any page on the internet. was going to be, right?

Yeah, I've wanted Genius back forever. Yeah. The good version of Genius.

Yeah, so maybe for the whole web. I think actually just starting with scientific papers is a great spot to start. I was explaining to Aman how this is important to the future of humanity the other day, to get him hyped up. But I honestly think this is a real step forward. So people should check that out if they want to read this paper but don't necessarily have all the technical depth to understand everything right away.

Cool. And I guess in closing, and maybe we'll just make this a part of it: if you had to explain in two sentences why "Attention Is All You Need" was so important, what should a dumbass like me take away? The first thing that you think when you hear "Attention Is All You Need" should be X.

Right. So it's a really simple model that gives great performance on a traditionally difficult task. And it's also faster, and in some sense more compute- and data-optimal, than anything that came before it. And it's the foundation for so many things that have come since. Transformers, which this paper more or less introduced, are the foundation for so many of today's large models. And I think that's why this is important.

Beautiful. Well, this was more fun than I even thought it was going to be. I think we'll be back next week to talk about chinchillas.86Chinchillas — Packy is joking about the model's name. The series' second episode, on Chinchilla, came out on November 25, 2022, five days before ChatGPT. So this is gonna be…

Yeah, that's…

…a lot of fun. I'll read up. Is there a paper that, if people want to just kind of read in the interim, is there the paper that they should read on chinchillas? And yes, let me put it in the show notes.

Parameters of the largest language models, billions
  1. LaMDA137
  2. GPT-3175
  3. Jurassic-1178
  4. Gopher280
  5. MT-NLG530
  6. Chinchilla70

Source: Hoffmann et al., Training Compute-Optimal Large Language Models, Table 1

Let me find it. It's… I always forget: "Training Compute-Optimal Large Language Models." Here it is. This is a really good paper to follow up this one with. And the reason is because when transformers dropped, everyone was like, okay, we're just going to make the largest possible model. We're going to put billions of parameters, we're going to just train it as large as we can go. And then the Chinchilla scaling laws show that, well, a lot of that is wasted effort, and here's exactly why.

So awesome. All right, well, I'll read up. I'm just going to dump this in Explainpaper, have it explain the paper to me, and then we'll do the human version next week.

Sounds great. All right, Packy, this is a lot of fun.

This is fun. Bye.

Talk later. Bye-bye.

Chapters
  1. 1Why Packy wants AI papers explained
  2. 2What the paper changed: parallel instead of one word at a time
  3. 3How a model learns: weights, loss and gradients
  4. 4Why the transformer was tested on translation
  5. 5Neural networks, transformers and LLMs: what contains what
  6. 6The encoder, box by box: embeddings, positions, attention
  7. 7The Bitter Lesson: are data and scale enough?
  8. 8The decoder: writing text one token at a time
  9. 9Why GPT-3 repeats itself, and how to give it a style
  10. 10What humans do while a model trains
  11. 11Explainpaper and the paper in two sentences

Related episodes