I'm a mathematician working at the university, this is a wonderful explanation of Transformers, explaining the meaning and not just the algorithm, very good
Amazing video ! I really appreciate that you explained the Transformer model *from scratch*, and didn't just give a simplistic overview of it 👍 I can definitely see that *a lot* of work was put into this video, keep it up !
@@qwsafirkmc9093 I disagree. Everything in this video is simplified to the extreme, on purpose. Because it is the only way to understand the global behavior quickly. Yes the attention formula is not shown but the whole process is illustrated (including the softmax operation). The tokenizer is far more complicated in practice than a one-hot encoding at word level (and a good tokenizer is apparently quite important for good performance). The positional encoding is, you guessed it, not a one-hot encoding either. It may be complicated enough on its own to require a whole explanation video. Point is, the whole approach is to avoid details. And I think it works quite well.
@@BenjaminDorra if I don't see how matrices are multiplied, the general shape of the tensor at each step and all that jazz I barely understand anything. That simple explanation would've done wonders are some tensor multiplication shenanigans
@@qwsafirkmc9093 Ok fair. From my understanding the attention matmuls behave more like a vector outer product, so every possible pairs of tokens (every token being themselves vectors) are combined (through simple element by element product), pretty much what is shown in the video. But yes it is not simple and I may be wrong. Math is hard !
Dude, your explanations are truly next level. This really opened my eyes to understanding transformers like never before. Thank you so much for making these videos. Really amazing resource that you have created.
Thanks for your explanation; This is probably the best video on RUclips about the core of transformer architecture so far, other videos are more about the actual implementation but lack the fundamental explanation. I 100% recommend it to everyone on the field.
This is the best I have found. I will watch it once a day for a few weeks to really be able to remember all of the steps. It amazes me how crudely simple LLMs are.
This is an excellent video! Highly underrated. While most videos explain algorithms, this explains the why, which gets me to understand the algorithm on a much deeper level. I wish this video would have ended with a summary of all the ideas covered and how those ideas are addressed by the transformer architecture. I was doing that in my head during the video, but not everyone may be as familiar. Thanks anyway. Please make many more videos!
Truly this is the best explanation of transformers I have seen so far. Especially great logical flow makes it easier to understand difficult concepts. Appreciate your hard work!
I am currently doing my PhD in machine learning (well, on its theoretical aspects), and this video is the best explanation of transformers I've seen on RUclips. Congratulations and thank you for your work
I love the algorithmic way of explaining what mathematics does. Not too deep, not too shallow, just the right level of abstraction and detail. Please please explain RNNs and LSTMs, I'm unable to find a proper explanation. Thanks !
Not so long ago I was searching for hours trying to understand transformers. In this 18 min video I learned more than I learned in 3 hours of researching. This is best computer science video I have ever watched in my entire life.
Wow just wow. This video makes you understanding really the reason behind the architecture, something that even reading the original paper you don't really get.
It seems like whenever I want to dive deeper into the workings of a subject, I always only find videos that simply define the parts to how something works, like it is from a textbook. You not only explained the ideas behind why the inner workings exist the way they do and how they work, but acknowledged that it was an intentional effort to take a improved approach to learning.
Absolutely love how you explain the process of discovery, in other words figure out one part which then causes a new problem, which then can be solved with this method, etc. The insight into this process for me was even more valuable than understanding this architecture itself.
This video is by far the clearest and best explained I've seen! I've watched so many videos on how transformers work and still came away lost. After watching this video (and the previous background videos) I feel like I finally get it. Thank you so much!
This is AMAZING I've been working on coding a transformer network from scratch, and although the code is intuitive, the underlying reasoning can be mind bending. Thank you for this fantastic content.
This video is exactly what I needed. Despite knowing what a transformer's made of, I still felt incompleteness and didn't know the motivation behind it. And your video answered this question perfectly. Now understanding why it works is another question.
Wonderful video. Easily the best video I've seen on explaining transformer networks. This "incremental problem-solving" approach to explaining concepts personally helps me understand and retain the information more efficiently.
Really well done, I haven't seen your channel before and this is a breath of fresh air. I've been working on my GPT + transformer video for months and this is the only video online which is trying to simplify things through an indepdnent realization approach. Before I watched this video my 1 sentence summary of why Transformers matter was: "They contain layers that have weights which adapt based on context" (vs. using deeper networks with static layers). and this video helped solidify that further, would you agree? I also wanted to boil down the attention heads as "mini networks" (or linear functions) connected to each token which are trained to do this adaptation. One network pulls out what's important in each word given the context around it, the other networks combines these values to decide the important those two words in that context, and this is how the 'weights adapt' I still wonder how important the distinction of linear layer vs. just a single layer, I like how you pulled that into the optimization section. i know how hard this stuff is to make clear and you did well here
My one-sentence summary of why transformers matter would be "they are standard CNNs, except the words are re-ordered in a way that makes the CNN's job easier first before being fed ". Also, a single NN layer IS a linear layer; I'm not sure what you mean by saying you don't know how important the distinction between the two is.
Thank you for not using slides filled with math equations. If someone understands the math they're probably not watching these videos, if they're watching these videos they're not understanding the math. It's incredible that so many RUclips teachers decide to add math and just point at it for an hour without explaining anything their audience can grasp, and then in the comments you can tell everybody golf clapped and understood nothing except for the people who already grasp the topic. Thank you again for thinking of a smart way to teach simple concepts.
I wasn’t aware that they were using a convolutional neural network in the transformer, so I was extremely confused about why the positional vectors were needed. Nobody else in any of the other videos describing transformers pointed this out. Thanks.
"they were using a convolutional neural network in the transformer" No no, Transformers do not have any convolutional layers, the author of the video just chose CNN as a starting point in the process "Let's start with the solution that doesn't work well, understand why it doesn't work well and try to improve it, changing the solution completely along the way". The main architecture in natural language processing before transformers was RNN, recurrent neural network. Then in 2014 researchers improved it with attention mechanism. However, RNNs do not scale well, because they are inherently sequential, and scale is very important for accuracy. So, researchers tried to get rid of RNNs and succeded in 2017. CNNs were also tried, but, to my not-very-deep knowledge, were less succesful. Interesting that the author of the video chose CNN as a starting point.
@@terjeoseberg990 A little off topic, but... Not long ago I noticed that RUclips deletes comments with links. Ok, automatic spam protection. (Still, the thing that it does this silently frustrates a lot...) But, does it also delete comments where links are separated into words with "dot" between them ? I tried to give you a resource I learned this from, but my comment got dropped two times...
@@Hexanitrobenzene, The best thing to do when RUclips deletes comments is to provide a title or something so I can find it. A lot of words are banned too.
Hey man, I watched your video months ago, and found it excellent. Then I forgot the title, and could not find it again for a long time. It doesn't show up when I search for "transformers deep learning", "transformers neural network", etc. Consider changing the title to include that keyword? This is such a good video, it should have millions of views.
Halfway through the video and I pressed the subscribed button. Very intutive and easy to understand. Keep up the good work man :) 1 suggestion: Change the title of video and you'll get more traction.
This was so helpful. I was reading through how other models work like ELMo and it makes sense how they came up with ideas for those, but the transformer it just seemed like it popped out of nowhere with random logic. This video really helps to understand their thought process.
Your visualization and explanation are very good. Helped me understand a lot. I hope you can put more videos, it must be not easy otherwise you would have done it. Keep it up.
I’ve watched so many video explainers on transformers and this is the first one that really helped show the intuition in a unique and educational way. Thank you, I will need to rewatch this a few times but I can tell it has unlocked another level of understanding with regard to the attention mechanism that has evaded me for quite some time.(darned KQV vectors…) Thanks for your work!
Damn FNN's and CNN's are basic stuff we were taught in our 4semester of our undergrad. Adam and RNNs were in the "additional resources" section for an Introdcutory course for Deep Learning I took in the same semester. Encountered LSTMs through personal projects lol Still haven't used GANs and Autoencoders, but it they were talk of the town back then due to the diffusion models.
@@newbie8051 yea I did FNN from scratch in high school, I was really hopeful for getting into Ai Research and then the transformers arrived in my college year…
As both a math enthusiasts and a programme (who obv also works on AI) I rly liked this vid. I can confirm that this is one of the best and genuine explanation of transformers...
🎯 Key Takeaways for quick navigation: 00:00 🤖 ChatGPT is powered by the transformer neural network architecture, enabling its advanced text processing capabilities. 01:26 🤔 Transformers were developed in response to the limitations of convolutional neural networks (CNNs) in handling natural language processing tasks. 03:00 icon CNN 04:00 icon 05:33 🔄 Transformers use pairwise convolutional layers to overcome the limitations of CNNs in handling long-range relations in text. 06:00 icon 07:26 📝 Transformers incorporate the position of words in their vector representations to account for word order. 08:00 icon 09:00 icon 10:00 icon 11:00 icon 12:29 🧠 Transformers use self-attention layers with linear representation functions, bi-linear scoring functions, and multiple heads to efficiently process input vectors. 14:00 icon 15:00 icon 16:58 🏗️ The complete transformer architecture includes multi-head self-attention, but standard implementations also involve layer normalization, residual connections, and byte-pair encoding.
Great video, maybe you could cover retentive network (from the RetNet paper) in the same fashion next - as it aims to be a replacement for the quadratic/linear attention in transformer (I'm curious as to how much of the "blurry vector" problem their approach suffers from).
I wish this had tied in specifically to the nomenclature of the transformer such as where these operations appear in a block, if they are part of both encoder and decoder paths, how they relate to "KQV" and if there's any difference between these basic operations and "cross attention".
I"ll be doing this, but in short, the little networks he showed connected to each pair are KQ (word pair representation) and the V is the value network., all of this can be done in the decoder only model as well. and cross attention is the same thing but you are using two separate sequences looking at each other (such as two sentences in a translation network). it's nice to know that GPT for example is decorder only, and so doesn't even need this
Can you explain how the NN produces the important-word-pair information-scores method described after 12:15 from the sentence problem raised at 10:17? Well it’s just another trained set of values. I supposs it scores pairs importance over the pairs’ uses in ~billions of sentences.
The importance-scoring neural network is trained in exactly the same way that the representation neural network is. Roughly speaking, for every weight in the importance-scoring neural network you increase the value of that weight slightly and then re-evaluate the entire transformer on a training example. If the new output is closer to the training label, then that was a good change so the weight stays at its new value. If the new output is further away, then you reverse the change to that weight. Repeat this over and over again on billions of training examples and the importance-scoring neural network weights will end up set to values so that that the produced scores are useful.
Very fascinating topic with an excellent dive and insights into how neural networks derive results. One thing I was left wondering is why is there no scoring vector describing the probability a word is a noun, verb. or adjective? Encoding a words context (regardless of language), should provide a great deal of context and thus eliminating many convolutional pairings, reducing computational effort. Thanks for a new found appreciation of transformers.
this is a good question and it's also a GOFAI type approach where we make the mistake thinking we can inject some human semantic idea to improve a network. but the reality is it will do this automatically without our help. For example papers back in 1986 show tiny networks automatically grouping words into nouns or verbs, it's amazing. let me know if you want more details
Thanks. Amazing video. One question though - how do you train the network to output the "importance score"? I get the other part of the self-attention mechanism, but the score seems a bit out of the blue.
The entire model is trained end-to-end to solve the training task. What this means is you have some training dataset consisting of a bunch of input/label pairs. For each input, you run the model on that input, then you change the parameters in the model a bit, evaluate it again and check if the new output is closer to the training label, if it is you keep the changes. You do this process for every parameter in all layers and in all value and score networks, at the same time. By doing this process, the importance score generating networks will change over time so that they produce scores which cause the model's outputs to be closer to the training dataset labels. For standard training tasks, such as predicting the next word in a piece of text, it turns out that the best way for the score generating networks to influence the model's output is by generating 'correct' scores which roughly correspond to how related 2 words are, so this is what they end up learning to do.
Great video, but I was wondering how one aspect of the transformer is handled in the real world. How are importance scores assigned to pairs in order to determine their importance? Basically, on a massive scale, how can important scores be automatically assigned in order to get the correct importance for a pair for a given sentence?
The entire model is trained end-to-end to solve the training task. What this means is you have some training dataset consisting of a bunch of input/label pairs. For each input, you run the model on that input, then you change the parameters in the model a bit, evaluate it again and check if the new output is closer to the training label, if it is you keep the changes. By doing this process, the score generating networks will change over time so that they produce scores which cause the model's outputs to be closer to the training dataset labels. It turns out that the best way for the score generating networks to influence the model's output is by generating 'correct' scores which roughly correspond to how related 2 words are, so this is what they end up learning.
Video about Diffusion/Generative models coming next, stay tuned!
Was coming to comment this, thanks
Please make video
Please!
I now realise that the key to understanding transformers is to ask why they work, not how. Thanks!
Thank you so much!
@@algorithmicsimplicity this is indeed quite eye-opening! Thanks for your video!
Awesome
I'm a mathematician working at the university, this is a wonderful explanation of Transformers, explaining the meaning and not just the algorithm, very good
Amazing video ! I really appreciate that you explained the Transformer model *from scratch*, and didn't just give a simplistic overview of it 👍
I can definitely see that *a lot* of work was put into this video, keep it up !
Would you share the source code for the animations?
This gem is underrated. This is the only video that after watching, I feel like I know how transformers work. Thanks!
you most likely don't. He didn't even show the attention formula
@@qwsafirkmc9093 I disagree.
Everything in this video is simplified to the extreme, on purpose. Because it is the only way to understand the global behavior quickly.
Yes the attention formula is not shown but the whole process is illustrated (including the softmax operation).
The tokenizer is far more complicated in practice than a one-hot encoding at word level (and a good tokenizer is apparently quite important for good performance).
The positional encoding is, you guessed it, not a one-hot encoding either. It may be complicated enough on its own to require a whole explanation video.
Point is, the whole approach is to avoid details. And I think it works quite well.
@@BenjaminDorra if I don't see how matrices are multiplied, the general shape of the tensor at each step and all that jazz I barely understand anything. That simple explanation would've done wonders are some tensor multiplication shenanigans
@@qwsafirkmc9093 Ok fair.
From my understanding the attention matmuls behave more like a vector outer product, so every possible pairs of tokens (every token being themselves vectors) are combined (through simple element by element product), pretty much what is shown in the video.
But yes it is not simple and I may be wrong. Math is hard !
Dude, your explanations are truly next level. This really opened my eyes to understanding transformers like never before. Thank you so much for making these videos. Really amazing resource that you have created.
당신의 설명하는 방식은 나의 뇌 속 퍼즐을 맞추는 길잡이가 되어줍니다. 저는 앞으로도 제작될 좋은 영상들을 응원합니다. Thank you from Korea.
Thank you so much for your support! I am happy to hear that even non-English viewers enjoy my videos.
Thanks for your explanation; This is probably the best video on RUclips about the core of transformer architecture so far, other videos are more about the actual implementation but lack the fundamental explanation. I 100% recommend it to everyone on the field.
yeah! this "functional" approach to the explanation rather than "mechanical" is truly amazing 👍👍👍👏👏👏
This is the best I have found. I will watch it once a day for a few weeks to really be able to remember all of the steps. It amazes me how crudely simple LLMs are.
Awesome video bro. i always like some intutive explanation.
Thanks so much!
Amazing presentation. Thanks!
Thank you so much!
Incredible, every one of your videos are crazy good. Post more!
Thank you so much! I am working on the next one at the moment!
This is the best Video on Transformers i have seen on whole youtube.
Thank you for answering my questions!!
Thanks for the tip! I'm always happy to answer questions.
This is an excellent video! Highly underrated. While most videos explain algorithms, this explains the why, which gets me to understand the algorithm on a much deeper level. I wish this video would have ended with a summary of all the ideas covered and how those ideas are addressed by the transformer architecture. I was doing that in my head during the video, but not everyone may be as familiar. Thanks anyway. Please make many more videos!
Thanks for the feedback, I will keep it in mind for my next videos!
Truly this is the best explanation of transformers I have seen so far. Especially great logical flow makes it easier to understand difficult concepts. Appreciate your hard work!
I am currently doing my PhD in machine learning (well, on its theoretical aspects), and this video is the best explanation of transformers I've seen on RUclips. Congratulations and thank you for your work
I love the algorithmic way of explaining what mathematics does. Not too deep, not too shallow, just the right level of abstraction and detail. Please please explain RNNs and LSTMs, I'm unable to find a proper explanation. Thanks !
Not so long ago I was searching for hours trying to understand transformers. In this 18 min video I learned more than I learned in 3 hours of researching. This is best computer science video I have ever watched in my entire life.
Thanks!
Thank you so much for your support!
This is the best transformer explanation video on youtube! Everything is so clear now!
Thank you for your work, I am currently doing a PhD in ML Systems and I learned several things from your video! Thank you for your service!
That is the possibly the best explanation of Attention I have ever seen!
There are many explanations of what a transformer is and how it works, but this one is the best I've seen. Really good work.
Wow just wow. This video makes you understanding really the reason behind the architecture, something that even reading the original paper you don't really get.
This is BY FAR the BEST explenation I have seen on this topic. You Sir are extremely talneted! keep up the great work and thank ou!
It seems like whenever I want to dive deeper into the workings of a subject, I always only find videos that simply define the parts to how something works, like it is from a textbook. You not only explained the ideas behind why the inner workings exist the way they do and how they work, but acknowledged that it was an intentional effort to take a improved approach to learning.
Absolutely love how you explain the process of discovery, in other words figure out one part which then causes a new problem, which then can be solved with this method, etc. The insight into this process for me was even more valuable than understanding this architecture itself.
Takk!
Wow, thanks so much for the support. It means a lot.
This video is by far the clearest and best explained I've seen! I've watched so many videos on how transformers work and still came away lost. After watching this video (and the previous background videos) I feel like I finally get it. Thank you so much!
This is AMAZING
I've been working on coding a transformer network from scratch, and although the code is intuitive, the underlying reasoning can be mind bending.
Thank you for this fantastic content.
Great videa, I am just starting with Transformers, but never thought about them in relation to convolutional networks
This video is exactly what I needed. Despite knowing what a transformer's made of, I still felt incompleteness and didn't know the motivation behind it. And your video answered this question perfectly. Now understanding why it works is another question.
This is incredibly good, next level stuff. Understanindg why people invent transformer is way more important than how it works.
Wonderful video. Easily the best video I've seen on explaining transformer networks. This "incremental problem-solving" approach to explaining concepts personally helps me understand and retain the information more efficiently.
Really well done, I haven't seen your channel before and this is a breath of fresh air. I've been working on my GPT + transformer video for months and this is the only video online which is trying to simplify things through an indepdnent realization approach. Before I watched this video my 1 sentence summary of why Transformers matter was: "They contain layers that have weights which adapt based on context" (vs. using deeper networks with static layers). and this video helped solidify that further, would you agree?
I also wanted to boil down the attention heads as "mini networks" (or linear functions) connected to each token which are trained to do this adaptation. One network pulls out what's important in each word given the context around it, the other networks combines these values to decide the important those two words in that context, and this is how the 'weights adapt'
I still wonder how important the distinction of linear layer vs. just a single layer, I like how you pulled that into the optimization section. i know how hard this stuff is to make clear and you did well here
My one-sentence summary of why transformers matter would be "they are standard CNNs, except the words are re-ordered in a way that makes the CNN's job easier first before being fed ".
Also, a single NN layer IS a linear layer; I'm not sure what you mean by saying you don't know how important the distinction between the two is.
thanks@@maxkho00
Thank you for not using slides filled with math equations. If someone understands the math they're probably not watching these videos, if they're watching these videos they're not understanding the math. It's incredible that so many RUclips teachers decide to add math and just point at it for an hour without explaining anything their audience can grasp, and then in the comments you can tell everybody golf clapped and understood nothing except for the people who already grasp the topic. Thank you again for thinking of a smart way to teach simple concepts.
amen. the power of out of the box teachers is infinite.
Very nicely done. Your graphics had a calming, almost hypnotic effect.
I wasn’t aware that they were using a convolutional neural network in the transformer, so I was extremely confused about why the positional vectors were needed. Nobody else in any of the other videos describing transformers pointed this out. Thanks.
"they were using a convolutional neural network in the transformer"
No no, Transformers do not have any convolutional layers, the author of the video just chose CNN as a starting point in the process "Let's start with the solution that doesn't work well, understand why it doesn't work well and try to improve it, changing the solution completely along the way".
The main architecture in natural language processing before transformers was RNN, recurrent neural network. Then in 2014 researchers improved it with attention mechanism. However, RNNs do not scale well, because they are inherently sequential, and scale is very important for accuracy. So, researchers tried to get rid of RNNs and succeded in 2017. CNNs were also tried, but, to my not-very-deep knowledge, were less succesful. Interesting that the author of the video chose CNN as a starting point.
@@Hexanitrobenzene, I suppose I’ll have to watch this video again. I’ll look for what you mentioned.
@@terjeoseberg990
A little off topic, but... Not long ago I noticed that RUclips deletes comments with links. Ok, automatic spam protection. (Still, the thing that it does this silently frustrates a lot...) But, does it also delete comments where links are separated into words with "dot" between them ? I tried to give you a resource I learned this from, but my comment got dropped two times...
...Silly me, I figured I could just give you the title you can search for: "Dive into deep learning". It's an open textbook with code included.
@@Hexanitrobenzene, The best thing to do when RUclips deletes comments is to provide a title or something so I can find it. A lot of words are banned too.
Man, your explanation just blow my mind! You should keep doing good work!
Hey man, I watched your video months ago, and found it excellent. Then I forgot the title, and could not find it again for a long time. It doesn't show up when I search for "transformers deep learning", "transformers neural network", etc. Consider changing the title to include that keyword? This is such a good video, it should have millions of views.
Thanks for the tip.
really made me appreciate NN even more. Thanks for the video
Halfway through the video and I pressed the subscribed button. Very intutive and easy to understand. Keep up the good work man :)
1 suggestion: Change the title of video and you'll get more traction.
Thanks, any title in particular you'd recommend?
This was so helpful. I was reading through how other models work like ELMo and it makes sense how they came up with ideas for those, but the transformer it just seemed like it popped out of nowhere with random logic. This video really helps to understand their thought process.
Explained thoroughly and clearly from basic principles and practical motivations. Basically the perfect explanation video.
Your visualization and explanation are very good. Helped me understand a lot. I hope you can put more videos, it must be not easy otherwise you would have done it. Keep it up.
What a simple but perfect explanation!! You deserve 100s time more subscriber.
Very nice video. Name of your channel reflects in the content of the video. Thank you.🙏🙏
This is by far the best explanation of the transformer architecture. Well done, and thank you very much.
I’ve watched so many video explainers on transformers and this is the first one that really helped show the intuition in a unique and educational way. Thank you, I will need to rewatch this a few times but I can tell it has unlocked another level of understanding with regard to the attention mechanism that has evaded me for quite some time.(darned KQV vectors…) Thanks for your work!
This was top notch. Please do one for RetNets and Liquid Neural Nets.
This was an excellent video on the global design structure for transformer. Love all your videos!
Good job! There was a lot of intuition in this explanation.
This video was all I needed for LLMs/transformers!
Cant wait for more content from your channel. Brilliantly explained.
Thanks!
Thank you so much for the kind words.
I keep coming back to this because it's the best explanation!!
Great concise visual presentation!
Thank you, much appreciated!
👍👍
I've started binge watching all your videos. 😁
best explainer of transformers I saw so far, thnx!
Very easy to understand explaination. Thanks.
Wow! I knew about attention mechanisms but this really brought my understanding to a new level. Thank you!!
I still remember when all the cool acronyms I had to deal with was just FNNs, CNNs, ADAM, RNNs, LSTMs and the newest kid on the block, GANs.
Damn FNN's and CNN's are basic stuff we were taught in our 4semester of our undergrad. Adam and RNNs were in the "additional resources" section for an Introdcutory course for Deep Learning I took in the same semester.
Encountered LSTMs through personal projects lol
Still haven't used GANs and Autoencoders, but it they were talk of the town back then due to the diffusion models.
@@newbie8051 yea I did FNN from scratch in high school, I was really hopeful for getting into Ai Research and then the transformers arrived in my college year…
You remember 2014 - 2015 too?!? 😂
This a truly great introduction. I've watched other also excellent introductions, but yours is superior in a few ways. Congrats and thanks! 🤙
thank a lot lot! this visual lecture cleared the dense fogs over my cognitive picture of the transformer.
I've had to watch this a few times, great explanation!
As both a math enthusiasts and a programme (who obv also works on AI) I rly liked this vid. I can confirm that this is one of the best and genuine explanation of transformers...
the first so far this year
the best explanation i ever seen, thank you
you deserve my like bro, really awesome video
Excellent explanation! All kudos to the author!
Great explanation. Havent found this perspective before.
This is one of the genuinely best and most innovative explanations of transformers/attention I've ever seen! Thank you.
🎯 Key Takeaways for quick navigation:
00:00 🤖 ChatGPT is powered by the transformer neural network architecture, enabling its advanced text processing capabilities.
01:26 🤔 Transformers were developed in response to the limitations of convolutional neural networks (CNNs) in handling natural language processing tasks.
03:00 icon CNN
04:00 icon
05:33 🔄 Transformers use pairwise convolutional layers to overcome the limitations of CNNs in handling long-range relations in text.
06:00 icon
07:26 📝 Transformers incorporate the position of words in their vector representations to account for word order.
08:00 icon
09:00 icon
10:00 icon
11:00 icon
12:29 🧠 Transformers use self-attention layers with linear representation functions, bi-linear scoring functions, and multiple heads to efficiently process input vectors.
14:00 icon
15:00 icon
16:58 🏗️ The complete transformer architecture includes multi-head self-attention, but standard implementations also involve layer normalization, residual connections, and byte-pair encoding.
The visualisation was amazing.
Clear Explanation. Fantastic.
This video is gold!
Subscribed.
I may be too late to the party but glad I found this channel.
best explanation i have seen so far.
Basically The transformer is cnn with a lot of extra upgrades. Good to know.
The best explanation I found so far!
FINALLY I have something me basic understanding. Thank you so much!
Great video, maybe you could cover retentive network (from the RetNet paper) in the same fashion next - as it aims to be a replacement for the quadratic/linear attention in transformer (I'm curious as to how much of the "blurry vector" problem their approach suffers from).
Insane that this website is free. Thanks!
I wish this had tied in specifically to the nomenclature of the transformer such as where these operations appear in a block, if they are part of both encoder and decoder paths, how they relate to "KQV" and if there's any difference between these basic operations and "cross attention".
I"ll be doing this, but in short, the little networks he showed connected to each pair are KQ (word pair representation) and the V is the value network., all of this can be done in the decoder only model as well. and cross attention is the same thing but you are using two separate sequences looking at each other (such as two sentences in a translation network). it's nice to know that GPT for example is decorder only, and so doesn't even need this
Finally!!!! Exactly the video I wanted!!!!
Sir I like your videos very much. Love from India ♥️♥️.
fantastic video, congratulations on and thank you for making it
never thought pf attention as pair-wise convolution ! interesting.
Thank you so much for this video.
Amazing explainations and video!
Can you explain how the NN produces the important-word-pair information-scores method described after 12:15 from the sentence problem raised at 10:17?
Well it’s just another trained set of values. I supposs it scores pairs importance over the pairs’ uses in ~billions of sentences.
The importance-scoring neural network is trained in exactly the same way that the representation neural network is. Roughly speaking, for every weight in the importance-scoring neural network you increase the value of that weight slightly and then re-evaluate the entire transformer on a training example. If the new output is closer to the training label, then that was a good change so the weight stays at its new value. If the new output is further away, then you reverse the change to that weight. Repeat this over and over again on billions of training examples and the importance-scoring neural network weights will end up set to values so that that the produced scores are useful.
Very fascinating topic with an excellent dive and insights into how neural networks derive results.
One thing I was left wondering is why is there no scoring vector describing the probability a word is a noun, verb. or adjective? Encoding a words context (regardless of language), should provide a great deal of context and thus eliminating many convolutional pairings, reducing computational effort.
Thanks for a new found appreciation of transformers.
this is a good question and it's also a GOFAI type approach where we make the mistake thinking we can inject some human semantic idea to improve a network. but the reality is it will do this automatically without our help. For example papers back in 1986 show tiny networks automatically grouping words into nouns or verbs, it's amazing. let me know if you want more details
I'd love to see you explain how KANs work.
Thanks. Amazing video. One question though - how do you train the network to output the "importance score"? I get the other part of the self-attention mechanism, but the score seems a bit out of the blue.
The entire model is trained end-to-end to solve the training task. What this means is you have some training dataset consisting of a bunch of input/label pairs. For each input, you run the model on that input, then you change the parameters in the model a bit, evaluate it again and check if the new output is closer to the training label, if it is you keep the changes. You do this process for every parameter in all layers and in all value and score networks, at the same time.
By doing this process, the importance score generating networks will change over time so that they produce scores which cause the model's outputs to be closer to the training dataset labels. For standard training tasks, such as predicting the next word in a piece of text, it turns out that the best way for the score generating networks to influence the model's output is by generating 'correct' scores which roughly correspond to how related 2 words are, so this is what they end up learning to do.
2:36 wow, just 50k words... that soud pretty easy for computers. amazing.
I think they were actually used as far back or more as 2006, in compressor algorithm competitions publicly
This video is damn impressive mann
Very interesting. Thank you for the video.
A good video, too much information to absorb but it is easy to understand, thanks!!!
Great video, but I was wondering how one aspect of the transformer is handled in the real world. How are importance scores assigned to pairs in order to determine their importance? Basically, on a massive scale, how can important scores be automatically assigned in order to get the correct importance for a pair for a given sentence?
The entire model is trained end-to-end to solve the training task. What this means is you have some training dataset consisting of a bunch of input/label pairs. For each input, you run the model on that input, then you change the parameters in the model a bit, evaluate it again and check if the new output is closer to the training label, if it is you keep the changes.
By doing this process, the score generating networks will change over time so that they produce scores which cause the model's outputs to be closer to the training dataset labels. It turns out that the best way for the score generating networks to influence the model's output is by generating 'correct' scores which roughly correspond to how related 2 words are, so this is what they end up learning.