Skip to content
0:00 / 0:00

#transformer#attentionmechanism#embeddings

Transformers, the tech behind LLMs | Deep Learning Chapter 5

3Blue1Brown

8.7M subscribers • 42 videos on Hallway

YouTube
  • Recommended by 14 people: 13 on Hacker News and 1 on Lobsters.
  • Presented by Grant Sanderson
  • Linked in the descriptionarXiv 1301.3781

Intermediate. Assumes working knowledge.

11M views2 years ago14 recommendations

AI and machine learningComputer scienceTransformers and LLMsNeural networks and deep learningMath for machine learning

Grant Sanderson provides a visual explanation of how transformers and large language models process data through embeddings and attention mechanisms.

Breaking down how Large Language Models work, visualizing how data flows through. Instead of sponsored ad reads, these lessons are funded directly by viewers: 3b1b.co/support --- Here are a few other relevant resources Build a GPT from scratch, by Andrej Karpathy youtu.be/kCc8FmEb1nY If you want a conceptual understanding of language models from the ground up, @vcubingx just started a short series of videos on the topic: youtu.be/1il-s4mgNdI?si=XaVxj6bsdy3VkgEX If you're interested in the herculean task of interpreting what these large networks might actually be doing, the Transformer Circuits posts by Anthropic are great. In particular, it was only after reading one of these that I started thinking of the combination of the value and output matrices as being a combined low-rank map from the embedding space to itself, which, at least in my mind, made things much clearer than other sources. transformer-circuits.pub/2021/framework/index.html History of language models by Brit Cruise, @ArtOfTheProblem youtu.be/OFS90-FX6pg An early paper on how directions in embedding spaces have meaning: arxiv.org/pdf/1301.3781.pdf Звуковая дорожка на русском языке: Влад Бурмистров. --- Timestamps - Predict, sample, repeat - Inside a transformer - Chapter layout - The premise of Deep Learning - Word embeddings - Embeddings beyond words - Unembedding - Softmax with temperature - Up next

Why it's here

14 people recommend this

What people say. Highly recommended as an exceptionally clear, visual explanation that makes the self-attention mechanism and transformer architecture intuitive.

BenoitPon Hacker News • Recommends

On “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 ea…

Wilduckon Hacker News • Recommends

On “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 link to this video

tomashmon Hacker News • Recommends

On “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. link to this video 1. link

manmalon Hacker News • Recommends

On “Embeddings are underrated (2024)”

This video explains the direction-encodes-trait topic very well IMO: link to this 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.

gf000on Hacker News • Recommends

On “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. link to this video This even opens up a more data-based approach to linguistics, where it is also heavily used.

robrenaudon Hacker News • Recommends

On “"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. link to this video

CharlesWon Hacker News • Recommends

On “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: link to this video

MAXPOOLon Hacker News • Recommends

On “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 link to this video Attention in transformers, visually explained | Chapter 6, Deep Learning link Full 3Blue1Brown Neural Networks playlist link

semiquaveron Hacker News • Recommends

On “Reasoning models don't always say what they think”

…e” 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. link to this video…

andrehackeron Hacker News • Recommends

On “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 link to this video

matthewolfeon Hacker News • Recommends

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

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

chan1on Hacker News • Recommends

On “Understanding Neural Network, Visually”

Super cool visualization Found this vid by 3Blue1Brown super helpful for visualizing transformers as well. link to this video

dannywon Hacker News • Recommends

On “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: link to this video Also, think about how a LLM would handle different languages.

jameson Lobsters • Recommends

But what is a GPT? Visual intro to transformers

meat_machineon Hacker News • Mentions

On “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…

tmshon Hacker News • Mentions

On “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…