What did Andrej Karpathy say changes when you move from bigram models to transformers?

Karpathy said almost nothing fundamental changes as you go from simple bigram models to transformers. The main difference is the forward pass, where the model takes in more previous characters and produces the next-character logits. The softmax, negative log likelihood, and gradient-based optimization all stay the same.

“None of this will fundamentally change. The only thing that will change is the way we do the forward pass where we take in some previous characters and calculate the logits for the next character in a sequence. That will become more complex, and, uh, but we'll use the same machinery to optimize it. And, um, it's not obvious how we would have extended this bigram approach into the case where there are many more characters at the input because eventually these tables would get way too large because there's way too many combinations of what previous characters, uh, could be.”
— Andrej Karpathy, Podcast/video interview, 2020-11 · at 1:46:51
Andrej Karpathy: Andrej Karpathy on Character-Level Language Modeling: Building makemore

Key takeaways

  • Separate the model architecture from the training machinery.
  • The same loss function can work across very different model sizes.
  • Architectural complexity can grow while the optimization recipe stays fixed.

Context

He was explaining how the makemore setup would scale from a one-character input to more powerful sequence models. The quote above is taken word for word from the recording's transcript.

In the transcript

…nets. But fundamentally, uh, the output of the neural net will always just be logits. And those logits will go through the exact same transformation. We are going to take them through a softmax, calculate the loss function and the negative log likelihood, and do gradient-based optimization. And so actually as we complexify the neural nets and work all the way up to transformers, none of this will really fundamentally

None of this will fundamentally change. The only thing that will change is the way we do the forward pass where we take in some previous characters and calculate the logits for the next character in a sequence. That will become more complex, and, uh, but we'll use the same machinery to optimize it. And, um, it's not obvious how we would have extended this bigram approach into the case where there are many more characters at the input because eventually these tables would get way too large because there's way too many combinations of what previous characters, uh, could be.

Actually keep everything in a table anymore. So this is fundamentally an unscalable approach, and the neural network approach is significantly more scalable, and it's something that actually we can improve on over time. So that's where we will be digging next. I wanted to point out two more things. Number one, I want you to notice that this X inc here, this is made up of one-hot vectors, and…

Read the full transcript of Podcast/video interview, 2020-11

Topics

What others said about artificial intelligence

More questions about Andrej Karpathy

All Andrej Karpathy answers · All Andrej Karpathy recordings

How this answer was made: the quote is checked word for word against the transcript of the recording and confirmed as the speaker's own words; the summary above it was drafted with AI from that transcript and quality-checked. Methodology and corrections.

Search every transcript
Open the full search page →