Transformers, the tech behind LLMs | Deep Learning Chapter 5

3Blue1Brown13 HN recommenders · 2024–2026
11.6M views · explainer · evergreen · Uploaded 2024-04-01

3Blue1Brown's visual explanation of how transformers and GPT-style language models work, tracing data through tokens, embeddings and attention.

HN treats it as the go-to visual introduction to transformers, and many say it finally made attention and embeddings click.

Watch on YouTube

16 comments from Hacker News

@meat_machine2024 · in “Could the cosmos, in fact, be conscious?”

from wikipedia: >Occam's razor is the problem-solving principle that recommends searching for explanations constructed with the smallest possible set of elements it's a general principle or _recommendation_, not some law of the universe. Some people might argue that "God wills it" is the simplest explanation for many things, but that doesn't mean it's true. The simplicity of an explanation doesn't necessarily have anything to do with its validity. In addition, the introduction of panpsychism, just like the introduction of God into any argument, brings up a whole other set of questions that need to be answered -- additional complexity, which is the opposite of Occam's Razor. Emergence out of complex systems is arguably the simpler explanation, because it's something that's already been observed, measured, and studied, like storms emerging from simpler principles of weather systems. Or take your computer or smartphone -- do you truly understand all the mechanisms from which we go from "shocking rocks" to create series of on/off signals, to things like communicating on the internet, or watching videos? Is computing and mathematics some inherent property of silicon? Nearly part of a computer, on some fundamental level, is a relatively simple mechanism, and has an almost useless function on its own. Even for engineers who understand every level of abstraction, it must still be near-miraculous that any of this works, even though these emergent properties are deliberately crafted, w

@CharlesW2024 · in “Ask HN: If AI can be creative, does this mean humans can be taught creativity?”

To quote GPT-4, "AI's 'creativity' is more about remixing and reinterpreting the information it has been fed". I think the degree to which a person perceives human-like creativity from AI/LLMs is inversely proportional to their understanding of how they work. Here's a great video that can help demystify GPTs: [VIDEO]

RecommendsView on HN
@tmsh2024 · in “You can't spell "Gell-Mann amnesia" without LLM”

I also dismissed LLMs given their "accuracy." But I think that's the wrong thing to compare. The sheer fact that a transformer architecture model gets better at scale and that we can feed it at scale is insane. It's what makes it AI and not just ML. The fact that you can get billions of parameters to do anything useful from a relatively simple algorithm on a relatively small amount (high GBs / low TBs) of text means the algorithm is insane. That's what people miss - they think GPT is trained on "the whole internet" and is similar to some of low-variate regression model that is "approximating things." It is absolutely approximating things - so does all intelligence -- but it is truly sifting / "attending to" what is important over a relatively small corpus and organizing into billions of parameters the way a brain would organize data. Will it hallucinate details? statistics? Etc.? Yes, and it should not be used in its current form for "truth." But it's very different from a low-variate model that is synthesizing in a low-dimensional space (which is how we gradually learn about the world) and an extremely-high dimensional model that is starting to see "what is important" in ways that are far, far above human intelligence. Similar to a human brain (due to the underlying neural architecture and any type of hierarchical compression of knowledge) but with far more input data, and a simplicity that maybe the brain has maybe it doesn't -- but is far more scalable and capable of hiera

@BenoitP2024 · in “Visualizing Attention, a Transformer's Heart [video]”

3Blue1Brown is really a godsend. I had been trying and failed to get an intuition for the self-attention mechanisms, and also why you want to stack you transformer layers. I went through a lot of material (Key-Query-Value interpretations, SVD of these, etc.) but his comment in chapter 5 video [1] made it click for me: "But you should think of the primary goal of this network that it (the word embedding) flows through as being to enable each one of those vectors to soak up a meaning that's much more rich and specific than what mere individual words could represent". Here is my intuition: Transformers are merely a Convnet for token sequences. In the sense that information is first local and each data means something wrt its immediate neighbors. You extract data locally, and then you dezoom to and redo exactly the same at a higher level. Convnet have been shown to reproduce edge detecting kernels first (vertical edge), then assemble them into basic shapes (vertical+oblique: corner), then bigger shapes (something round), then link shapes together (round+round separated by a horizontal shape with rectangles on top), and then it's a car! [2] Transformers do the same. They assemble meaning among tokens ("ju" + "mps" : a conjugated verb), then assemble these at a higher level ("cat jumps" -> noun+verb), then it's a sentence "the cat jumps over the wall", then a paragraph, then a chapter, then a book. All differentiable so any deviation from something coherent can tweak its knobs high

Strongly recommendsView on HN
@Wilduck2024 · in “Ask HN: Why can't ChatGPT solve Wordle-type questions?”

3Blue1Brown has a fantastic video on GPT that I'd highly recommend called "But what is a GPT? Visual intro to transformers" [1]. You'll need to have some background in mathematical reasoning, but not too much. He does a great job of drawing pictures to show the mathematical transformations that happen under the hood. [1] [VIDEO]

Strongly recommendsView on HN
@tomashm2024 · in “The Illustrated Transformer (2018)”

This is good, but what bade me finally understand the transformer architecture [0] and attention [1], are 3Blue1Brown's videos. 0. [VIDEO] 1. [LINK]

Strongly recommendsView on HN
@MAXPOOL2024 · in “The Engineer’s Guide to Deep Learning: Understanding the Transformer Model”

There are many others that are better. 1/ The Annotated Transformer Attention is All You Need [LINK] 2/ Transformers from Scratch [LINK] 3/ Andrej Karpathy has really good series of intros: [LINK] Let's build GPT: from scratch, in code, spelled out. [LINK] GPT with Andrej Karpathy: Part 1 [LINK] 4/ 3Blue1Brown: But what is a GPT? Visual intro to transformers | Chapter 5, Deep Learning [VIDEO] Attention in transformers, visually explained | Chapter 6, Deep Learning [LINK] Full 3Blue1Brown Neural Networks playlist [LINK]

RecommendsView on HN
@semiquaver2025 · in “Reasoning models don't always say what they think”

LLMs are completely deterministic. Their fundamental output is a vector representing a probability distribution of the next token given the model weights and context. Given the same inputs an identical output vector will be produced 100% of the time. This fact is relied upon by for example [LINK] a lossless compression system that would not work if LLMs were nondeterministic. In practice most LLM systems use this distribution (along with a “temperature” multiplier) to make a weighted random choice among the tokens, giving the illusion of nondeterminism. But there’s no fundamental reason you couldn’t for example always choose the most likely token, yielding totally deterministic output. This is an excellent and accessible series going over how transformer systems work if you want to learn more. [VIDEO]

RecommendsView on HN
@andrehacker2025 · in “Writing an LLM from scratch, part 13 – attention heads are dumb”

It is regarded to be "the best" book on the topic by many. I found just like what Giles Thomas wrote that the book focuses on the details and how to write the lower level code without providing the big picture. I am personally not very interested in that as these details are likely to change rather quickly while the principles of LLMs and transformers will probably remain relevant for many years. I have been looking for, but failed, to find a good resource that approaches it the way 3blue1brown [1] explains it but then go deeper from there. The blog series from Giles seem to take the book and add the background to the details. [1] [VIDEO]

RecommendsView on HN
@manmal2025 · in “Embeddings are underrated (2024)”

This video explains the direction-encodes-trait topic very well IMO: [VIDEO] It’s the first in a series of three that I can very highly recommend. > there's no way that there's a 1-to-1 correspondence between concepts and dimensions. I don’t know about that! Once you go very high dimensional, there is a lot of direction vectors that are almost perfectly perpendicular to each other (meaning they can cleanly encode a trait). Maybe they don’t even need to be perfectly perpendicular, the dot product just needs to be very close to zero.

Strongly recommendsView on HN
@matthewolfe2025 · in “Show HN: TokenDagger – A tokenizer faster than OpenAI's Tiktoken”

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

RecommendsView on HN
@retr0reg2025 · in “Words are lossy compressor, LMs speaks in meanings”

This high dimensional vector space does allows them to theoretically embed a interpretable "deeper understanding", reference [VIDEO] . It's the pre-train process that determines whether or not they demonstrate this "deeper understanding". This "deeper understanding" refers to the understanding to the word, can be contextual, pragmatic, or semantic.

@gf0002026 · in “King – man and woman is queen; but why?”

I really recommend watching this section of this video. Embeddings do encode plenty of "human knowledge" into the vector values and their relations to each other. [VIDEO] This even opens up a more data-based approach to linguistics, where it is also heavily used.

Strongly recommendsView on HN
@chan12026 · in “Understanding Neural Network, Visually”

Super cool visualization Found this vid by 3Blue1Brown super helpful for visualizing transformers as well. [VIDEO]

RecommendsView on HN
@dannyw2026 · in “Claude Token Counter, now with model comparisons”

LLMs are explicitly designed to handle, and also possibly 'learn' from different tokens encoding similar information. I found this video from 3blue1brown very informative: [VIDEO] Also, think about how a LLM would handle different languages.

RecommendsView on HN
@robrenaud2026 · in “"They're made out of weights"”

3 blue 1 brown has a great visual introduction to transformers, the heart of LLMs. It's chapter 5. Start at chapter 1 if you want more background on neural nets and backprop. [VIDEO]

Strongly recommendsView on HN