Synthesizer: Rethinking Self-Attention in Transformer Models (Paper Explained)
deep learning machine learning arxiv explained neural networks ai artificial intelligence paper nlp natural language processing machine translation google attention mechanism attention transformer seq2seq bert memory lsh locality sensitive hashing reversible revertible flow long sequence
Do we really need dot-product attention? The attention mechanism is a central part of modern Transformers, mainly due to the dot-product attention mechanism. This paper changes the mechanism to remove the quadratic interaction terms and comes up with a new model, the Synthesizer. As it turns out, you can do pretty well like that!

OUTLINE:
0:00 - Intro & High Level Overview
1:00 - Abstract
2:30 - Attention Mechanism as Information Routing
5:45 - Dot Product Attention
8:05 - Dense Synthetic Attention
15:00 - Random Synthetic Attention
17:15 - Comparison to Feed-Forward Layers
22:00 - Factorization & Mixtures
23:10 - Number of Parameters
25:35 - Machine Translation & Language Modeling Experiments
36:15 - Summarization & Dialogue Generation Experiments
37:15 - GLUE & SuperGLUE Experiments
42:00 - Weight Sizes & Number of Head Ablations
47:05 - Conclusion

Paper: https://arxiv.org/abs/2005.00743
My Video on Transformers (Attention Is All You Need): https://youtu.be/iDulhoQ2pro
My Video on BERT: https://youtu.be/-9evrZnBorM

Abstract:
The dot product self-attention is known to be central and indispensable to state-of-the-art Transformer models. But is it really required? This paper investigates the true importance and contribution of the dot product-based self-attention mechanism on the performance of Transformer models. Via extensive experiments, we find that (1) random alignment matrices surprisingly perform quite competitively and (2) learning attention weights from token-token (query-key) interactions is not that important after all. To this end, we propose \textsc{Synthesizer}, a model that learns synthetic attention weights without token-token interactions. Our experimental results show that \textsc{Synthesizer} is competitive against vanilla Transformer models across a range of tasks, including MT (EnDe, EnFr), language modeling (LM1B), abstractive summarization (CNN/Dailymail), dialogue generation (PersonaChat) and Multi-task language understanding (GLUE, SuperGLUE).

Authors: Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, Che Zheng

Links:
YouTube: https://www.youtube.com/c/yannickilcher
Twitter: https://twitter.com/ykilcher
BitChute: https://www.bitchute.com/channel/yannic-kilcher
Minds: https://www.minds.com/ykilcher
 Hi there! Today we're looking at synthesizer rethinking self-attention in transformer models by Yi Tai, Dara Barry, Donald Metzler, Da Cheng Chuan, Chih-Zhao and Chih-Ching. These people are of Google research and on a high level they're trying to replace the self-attention mechanism which is currently a dot product mechanism in a transformer by a sort of a learned attention mechanism, therefore eliminating this expensive dot product. They test the model and conclude that it sometimes works a bit. So the results are sort of inconclusive. But that's the paper on a high level and it's fairly cool to go through. As always, if you like content like this, consider subscribing and sharing it out. Alright, so they say the dot product self-attention is known to be central and indispensable to state-of-the-art transformer models. If you don't know what a transformer is, it's best I made a video on the attention is all you need paper and that explains what a transformer is and what an attention mechanism is in detail. But they are right. Of course the attention mechanism that is via the dot product of queries and keys is pretty much what makes transformers transformers. And they here ask is it really required? Which is a bold question in light of that, right? They say they investigate whether or not you really need this and they say via extensive experiments we find that first random alignment matrices surprisingly perform quite competitively and two, learning attention weights from token-token, that means query key interactions, which is this dot product interaction, is not that important after all. Okay, they propose this new model called synthesizer, a model that learns synthetic attention weights without token-token interactions. Our experimental results show that synthesizer is competitive against even NILA transformer models across a range of tasks. Okay, so let's dive in. So what is different here? They're basically saying look in each transformer layer boils down to something like this, where you have an input sequence X right here and you want to get an output sequence Y. And in order to do that you need some sort of this thing, which is the attention matrix, multiplied by this thing, which are called the values. And we'll explore that a bit deeper over here. So in these transformers it's always kind of helpful to visualize yourself the input sequence as sort of nodes. And so this would be one layer, we have a five length sequence and we want to transform it into the next length five sequence. And maybe it even helps to label maybe like A, B, C, D, E. You can just imagine kind of these, of course as you go up the layers it doesn't necessarily always correspond to the same input token. But the position labeling them is still pretty helpful, I find, especially for things like BERT or something like this. So you want to transform the sequence that's incoming here into another sequence. And the basic mechanism in a transformer, if you go up the layers, is the routing of information. So you want to route information around the sequence and basically such that at the end the whole sequence knows about every word in the sentence, knows about every other word that there is in the sentence, knows about the associations between the other words and so on, such that you gain sort of, you start out with individual words and that the end, what you want, is sort of that every word has a pretty good idea of what's going on with every other word. And that's why you continuously, as you go up the layer, route around this information. Now the question is how do you route this information? How do you know which word goes to which other word? And here maybe the sentence starts with the word, let's call Sarah, okay? Sarah and then it goes on and at some point it says she. So she is the pronoun and we can also label these Sarah, she. So if we want to, if we think how do we route information, it would be beneficial for us if the information that there is a word Sarah here in the sentence would be routed to the word she, because the word she, it's a pronoun, it knows I'm a pronoun and if there is like a person in the sentence that would be valuable information for me, like to know what's kind of going on and to understand myself better. Basically every word wants to understand itself and it kind of calls out for information from the other words. In a transformer this is done via what this paper calls this dot product attention and that's the follows. Every word, every token emits what is called a key and a value and the key and the value are just two vectors. So every word is going to emit two vectors. I'm going to draw one at the bottom here and I'm going to draw one at the top. Like that. So you can imagine the key as sort of the word advertising what it is to other words and so these are the keys down here and you, sorry, the top, I think I called it value, that's wrong, it's called a query. You can imagine the query as a word asking, describing what it wants from others to know. So in that case you'll see that the vector here and the vector here, these are now routed by dot product. So the ones that align in the dot product, in the angle, they will be routed to each other. So this would be routed here and maybe, you know, okay I drew this, this one would be routed here and the others would be kind of routed some a bit here and a bit here maybe. Okay it gets fuzzy but you get the concept. But in order to do that you basically need to pull to put the dot product from every single key with every value, sorry, query. And that gives you basically this quadratic dot product that these transformers have and that's expensive. Okay so they have a little picture here. This is what a vanilla transformer does. Every input here emits two things, a query and a key and then there's the dot product attention to decide what's this attention matrix. Okay now this attention matrix is then used to aggregate these values. So actually every token emits three things, also this value here, which is basically, it's not that important but this just describes the information that you want to pass on to the next layer and then it goes through this routing right here that routes the information to the correct output places and you get your output. Now what they propose is something different. They propose this dense synthesizer right here where instead of the dot product attention every single input here emits a basically a row of this matrix directly without having to go through the dot product. That helps a bit if you imagine it in our little framework here. So let's draw this again and let's see what this synthesizer, by the way they call this the dense synthesizer because they have another variant as well. Okay here is our sequence, the lower layer we want to transform it in the upper layer. This is the Sarah node and this is the she node. So how do we route information now? Okay I missed that. In the dense synthesizer framework every token just gets to output, basically it already gets to output where it wants information from. So every single token here gets to output where it wants information to come from and by where because in the original transformer the where was basically defined by these inner product. Now the where is just defined by the position. So it just says I want information from position 2 and 3 or this node here could say I want information from position 5 and 3. And this is dependent on which token there is. So each token looks at itself and in the case here of she you can imagine this token says well I'm a pronoun therefore I may be referring to a person and I know that in the English language a person is often at the beginning of the sentence and therefore I certainly want information from token from position 0. It doesn't see that there is this word Sarah here. It simply can see only the positions 0, 1, 2, 3, 4. So it will output, it will basically output, each token here will output an L dimensional vector and L here is the length of the sequence. An L dimensional vector that already defines the distribution of how you want the information. So I want lots of that and then not much of that and maybe it wants a bit of that and then not much of that. So each word up here is going to emit this L dimensional vector. So each word, each token decides for itself where it wants information to come from based purely on what the token itself is. And of course in the higher layers this information, like the information of what the token is and what else is there gets aggregated and that's how computation happens. But in a fundamental level each node looks at itself and decides where do I want information from just given what I am and not what others are. So this results in you not having to do this dot product attention. But of course you lose the information of what's down here. You simply go on the positions of the nodes and they formalize this like this. So they basically say okay each transformer mechanism needs some sort of a softmax over this matrix B right here. This is this routing matrix and then G of X is just the values of X. So G is often just a linear function. And they say well this B here in the classic transformer is computed via this dot product attention. Can't we just simply have a function right here that just outputs the B given an X. So you see here XI refers to one row. So X here is an L by D matrix and they say the sequence length is L. So if you imagine this is the sequence length, every XI is a vector here of dimension D. Sort of like a word embedding. Now what you want to do is you want to take each individually, run it through the function F and then get out an L dimensional vector. This is of dimension L. And if you do this with enough of the with all of the X's you'll get an L by L matrix which basically is now your routing matrix. So this thing tells you that this particular piece in the input sequence wants how much information from this particular piece in the output sequence or vice versa. See this is the problem here. They don't really specify this B, how this B matrix will be composed from the B I. Is B I a column or a row of this B matrix? I don't know. And therefore it could actually be the other way around. That's the information, it's not the sort of the tokens deciding where they want information from but it could be the tokens deciding where they want to send information to. But just from the notation I can sort of guess that it's the way that I described right here. But I hope you see the difference here. Before we had this dot product here each of these columns basically is an independent evaluation of this function that only considers X I and doesn't consider any of the X J that it wants information from. It simply goes by position. And they use for this, they use this basically this two layer, one hidden layer neural network right here. Two weight matrices and a non-linearity, a ReLU non-linearity. So they replace the dot product by simply learning what the attention pattern is going to be per individual token. Now they do it one step further. They say okay so we've already lost the dependency basically on what the input sequence tokens here are. Can't we also just kind of lose the dependency of what the output token sequences here are? So what they propose in their second variant, this random synthesizer, is the following. Why don't we just learn how the information is going to be routed, irrespective of which tokens come in? We're just gonna learn this and it's going to be one routing pattern for all of the possible input output sequences. It's just going to be this routing pattern. So they have actually two variants. First one where it is really just random, like they just leave it random and they don't even train it. And the second one where they train this thing. But these things now have nothing to do with the tokens. They're just fixed and they are just global. So this would directly be, you learn this L by L matrix. So if this strikes you a bit in an odd way, because you kind of lose the dependency on your data in this routing pattern and it's not really routing anymore, and if you think that you've seen this before somewhere and you think, hey that looks like a feet forward layer from your very first MLP, then you would be absolutely correct. And I'm not sure why they don't point this out. I have a really hard time believing that they themselves tricked them into such a thing right here. So I can actually show it. So the question is how is this here, this dense synthesizer, is this still different or the same as a feet forward layer? And is this different or the same as a feet forward layer? So if you do the math and you look at what a feet forward layer is, in a feet forward layer, yi, my i-th entry in the output, is going to be a sum over all the inputs xj multiplied by a weight ij. So whenever I can represent something in this fashion, where I have a sum and then I have like a fixed weight that I learn and that has nothing to do with x, that is not dependent on x, multiplied by x, then it is a feet forward layer basically, or like a fancy feet forward layer. So let's look at the dense synthesizer. What does the dense synthesizer do? The dense synthesizer says yi is equal to a sum. Okay we're starting off, we're starting off well. And so it says g of xj, but this g usually is just a weight matrix where we compute the values. We said this was the values of x. So g is usually just a matrix, let's call it vw. And then here we have like some softmax thing. We have some softmax and the softmax is going to be over this dense pattern right here that we described here. And this pattern is going to be f of xj. So no, xi, f of xi. Is that correct? Xi and here is a j. Maybe. Yes, that's correct. And f, okay, it's like two, it's two layers, but we can basically say it's like a weight matrix. Because ultimately if we learn a neural network or a single layer, it doesn't really matter to the discussion here. So let's call this wb xi. So you see right here we do have a weighted sum over the xjs, but the weight that the weighted sum is using is dependent on xi right here. And therefore you can't represent this as just a feet forward layer right here. Of course if you have the full dot product attention, then in here would actually be a dot product between xj and xi, right? So xj transposed xi or something like this. So what about this random synthesizer? So the random synthesizer has yi, has a weighted sum over this wv xi, that's the values, softmax over this matrix R. And R is simply this L by L matrix right here. Now you can immediately see that this part right here is static, it doesn't depend on any x and it is learned as a joint function, right? So this, if I just call this w, wij, then I'm back to my formulation, right? I'm sorry, ij. Then I basically have my feet forward layer. So the random synthesizer is just a fancy way of writing a feet forward layer. Now of course if you're going to have the softmax you maybe have some different inductive biases in learning it, but ultimately it is a straightforward feet forward layer. At least that's what it looks like to me. I am very open to be convinced otherwise. Okay so they have this drawing right here on the left you see the vanilla transformer, the dense synthesizer in the middle where you kind of learn how to produce this matrix and then route the value through it. And on the right where you simply output this in a learned or actually completely random fashion and then route your values through that to the output. Okay now the question of course is, okay they also do factorize it, but this is not really the... this is more of a point where now you can actually, if you have such a matrix or you produce such a matrix, you can then factorize it into sort of lower dimensional matrices. And that is first of all to save space and it is also a regularizer because what you're essentially saying is you're applying an inductive prior to say I think these matrices have like some low level structure to them and if you factorize them that's a prior on that exactly. So you can factorize the dense and the random synthesizer into smaller matrices and that will save you parameters. And you can actually also mix two. So you can for example mix the random and the dense synthesizer. Now you have to pay attention it's not like an interpolation. If you mix random and dense you will have to learn the parameters of the random end of the dense synthesizer. So that's going to be like strictly more powerful than either one alone. They list everything here where they say the standard dot product attention. What we have is we have this formula right here you can actually formulate it in their framework. You condition on all the Xj for any Xi and ah see here I wrote this as Xj I was dumb. It should be the entire X. And there is interaction between the tokens and it's going to cost you 2d squared parameters. Now parameters are different from computation which if you don't do the dot product you also save a bunch of computation but here they look at a number of parameters. So in this random synthesizer you simply output this matrix R. It's global. There's no interaction and you are you are it's cost you L squared memory in L squared parameters. Now often in these models L and D are actually pretty similar. So L might be something like 512 tokens the length and the dimension right here might also be something like 512. So per se this is not really a saving in parameters only when you go to the to the factorized models right here. Can you bring in this K and K is this lower dimension of factorization and if K is much much smaller than L then you save a bunch of parameters. The dense synthesizer formula is like this. This is how you produce the attention matrix. You condition on XI but not Xj right? For each YI you condition on XI and you do not care about the Xjs. It is local that means it depends on XI so the routing actually depends on the information that goes through but there is no interaction and you're going into D squared plus DL which is also pretty much 2D squared. Or you go to this lower number here if you choose a good K. Alright now experiments. So they apply this and we are absolutely stoked how this is going to turn out. So they go on machine translation. Now okay before we go into the results do you think machine translation is a good or a bad task for this model? Okay I think it is a good task for this model. It is a very favorable task for this model. Why? Why is machine translation a favorable task? Well mostly in machine translation if you think about how information is routed. So I have a sequence of German. Let's call it or English let's call it the dog barks. And I have a sequence of German. Der Hund belt. Come on. Hund belt. Now okay first of all I know they are only talking about self-attention so this example here actually makes little sense in the actual practical applications but I just want to demonstrate why machine translation specifically has... So how would you route information here if you have to route information between the two things? What you would do is pretty deterministically do this right? So in machine translation what is very very very often the case is that mostly you're going to align the positions in the same way independent of the input. Specifically here you would always most of the time align the beginning with the beginning the end with the end and so on because for most languages especially similar languages like English and German the order of sentences and number of words per thing you need to express is going to be roughly the same. So if you did not know about even about what the sequences were or you only knew one of them like you only knew there and you have to guess where should information come from well I know in English you also start with like this what's this called an article yeah it yes this is an article showing my linguistic skills here you you would also you would also start with that right you would say I want most information from position zero obviously I don't care what there what what is there so I and again I know they only do it in self-attention so it actually makes no sense that I have two different languages here but machine translation is probably a task that lends itself very much to sort of global globally learned or only partially partial observably learned attention patterns because just because of the nature of the task right so let's keep that in mind and go to the go to the results right here now they first of all what they do is they list the original transformer paper and actually have it here because they have to they have this same experiment now this is the kind of transformer we're talking about right here and it is notable that this paper only proposes to replace the self attention that means the attention that would be within one of these two columns and not the attention that goes across from the left to the right right but still you can see that the attention that goes from the left to the right then in the next layer is going to end up as self-attention information right so my I think my argument still counts in the in this case in the machine translation case alright so they have this same experiment right here here yes they have English German translation and they their base model gets twenty seven point three and that's what they evaluate right here they list this twenty seven point three but they also say when we train it we get a bit of a higher number twenty seven point six seven and especially on English French they get a higher number than that but let's stick to English German for now now they also do language modeling which the original paper didn't do and record the perplexity right here okay so the first thing they point out is if we train the synthesizer with a fixed random matrix that means we just put a random routing and we do not we do not ever change it what's there to learn so if you want to learn something in the transformer there's still many things to learn there's the feet forward layers right there is the the value encoder and so on so it is it is reasonable to assume that the transformer could sort of learn to just handle the attend the routing pattern that is in place that did the rest of the model can sort of absorb that shock and interestingly you get on to twenty three point nine so almost twenty four blue points and I mean it seems they point out that it's fairly close if you look here this twenty four is actually pretty far away it's the worst the worst baseline right here in the original paper despite net had this twenty four blue I mean it's I guess it's cool to point out that it works as such but you know in these tasks actually many things work right with with if you distill this down to some sort of a bag of words model and so on I'm pretty sure you can get pretty pretty good results as well and you can get you know fairly you can go to twenty four blue actually have no clue of this field but I just want to point out just because the number is in the same ballpark doesn't mean that it is very astonishing it's maybe just you have so many parameters that the rest of the model can sort of absorb this shock of not of not being able to learn this and can just handle whatever pattern you put there it can just kind of work with it that's many people have observed if you like put just random junk in the lower layers of a CNN like random filters never train them you can still the rest of the network can adapt so that's basically this effect right here I don't think it's a testament to we don't need the dot product attention it's more like this this just happens in deep learning then however they say if we now learn this one matrix so we learn this routing but globally we get into twenty seven point two seven blue and this already seems fairly close right and you mainly need to compare with this number right here because that's actually the same training run and so on so but still it is quite it is quite a bit away it's point four blue points away and that is a sort of significant difference I think then they go further if they go to the dense synthesizer you can see right here the model size is lower than this one and they get twenty seven point four three now they get even closer right and they are actually on par if they mix random and dense right here and you can see that it's also almost the same amount of parameters and when they mix these random and vanilla so what they now have is the dot product attention plus a purely global feed-forward sort of like a bias of what to route where then they can out compete this original model but also now they have more parameters right so this model you would expect it to be you know strictly better than either of the two alone and it is and it is actually astounding that the synthesizer that mixes the vanilla with the dense even though it has even more parameters it does worse so with these sort of results especially then you go fiddle with like point one you know between this and that I know I said point four blow is a lot so point one must be something and it surely is but also it's always the question of how many hyper parameter tunings you put into something like this and generally you you should always sort of look at this if you were a researcher had to put the best possible numbers here what would you do and then you correct for that in your mind for how much it might actually work if you if you are to if you are to you know go ahead and and train that on your data but nevertheless it gives some cool insights right what I'm a bit confused by is that if you sort of look at the original paper and you look at the perplexities and they have a table down here where they compare a bunch of their instantiations of their model and you compare the comparison the perplexity on a language modeling task and the perplexity here seems to correlate extremely well with the blue score right where as the perplexity here if you look at the perplexities over here they do correlate but I somehow I have the feeling they don't really correlate as much here which sort of speaks to the fact that you're going to see in the rest of the paper that these models they tend to sometimes be able to do well but then other times not and it's not really clear super clear when so look at this for example they now apply their models to summarization and dialogue generation right these are two tasks where you need to output text and you can see that the results are all over the place so in this metric Rouge to and Rouge is sort of an engram overlap metric between gold standards and what you produce in this metric the original transformer is best but in Rouge one this synthesizer mixed here is the best and in Rouge L this one is the best and in dialogue generation all of them are actually not as good as this one right here where it's just the dense which is strictly less powerful than the ones on the bottom but so as you as you can see yeah I think what you should take away from this is that it it is interesting that it sometimes works but it seems to be a fair bit of shakiness to these to these results okay now they go on and they test this on super glue and this is a benchmark so glue and super glue they consist of these different tasks right here and now we are out of the text generation game we are in the game of for example you have two sentences and you need to decide which which one is like which one entails the other or are they contradictory or things like this so it's more of a late say a classification task and people apply different models so it's no longer a text generation task so they switch model instead of the vanilla transformer from the attention is all you need paper they now go on to the t5 the text to text transformer and they change they simply take the architecture and they change the attention in there with their attention and you can see right here that the results are quite different than before so in every single case either the t5 model the base model with the dot product attention is the best model or the synthesizer but including V so plus V means plus vanilla means it also has the dot product attention plus this learned thing right here okay so our is now the learned I think the learned right I would be surprised if it was the random random but it could also be but in any case it's strictly better right it's strictly more powerful model and the only way you can actually perform worse is when you know it's too many parameters and so on and they kind of take stuff from each other and there is effects where more parameters can hurt you but never is any model that doesn't have the dot product attention on on top and these authors here argue that that's this can be largely attributed to the fact that the encoder self-attention in the t5 setting also functions as a cross-sentence attention so what do they mean here if in the t5 is just as I understand it this is just like an encoder like Bert so imagine imagine maybe this is Bert right what Bert is simply an encoder only transformer that means you here you put in your sequence and out again comes a sequence and you have like a special token that you use for classification and so on so this is less when you have to generate text but more when you want to classify text or things like this find something in a text and what you would do if you have two sentences you need to decide something about them you put the first sentence here and then you say you put like a separator token here this usually called like a separator token and then you put the second sentence here is you just concatenate them and you let them go into the transformer and they argue that if you do self-attention on this entire sequence then you get attention patterns like this and this is sort of like cross-attention between sequences right it's not really self-attention and that's why their method doesn't work because it basically deals with self-attention but I'm not really buying that argument I mean if this is a sequence it is if this is one sequence this is self-attention and if you were going to argue that out of the blue a token in your case like in your original formulation can simply you know just by looking at itself know where where which position it wants the information from and certainly here this token could also learn that it wants information from over here or from the first word here I don't I don't really see the difference maybe maybe you need to somehow standardize where this separator token is so that it's always in the same place and that the second sentence always starts at the same place but if you have that then I really don't see any difference in the argument you can make here that this shouldn't work as much as the others what I think is happening is that this task is simply involves more difficult reasoning involves more routing of information like dynamic routing that's actually dependent on what's in the tasks rather than something like machine translation which most of the time has some global routing bias like like some some pattern that works pretty well across all alright so the last part here is where they kind of introspect the model and in the in the first thing they say okay we look at the distribution of weights so these are the weights the weights in the decoder at the beginning of training and you can already see that the standard transformer weights are and the synthesizer weights are different from the sorry the dense synthesizer weights are different from the random synthesizer weights and this probably is mostly due to the fact of how you initialize like these deep learning frameworks if you have a matrix they will look at what's this dimension what's this dimension and calculate how they have to initialize it such that sort of the the total norm of a random vector that goes through stays the same sorry the vector would go through like it would go in here and out there so you see if it changes dimension then if you just randomly initialize with all the same like every matrix with the same number then like with the normal distribution then the in this case the vector would gain in norm and to account for that you initialize the matrices such that the vector norms approximately stay the same and this is why there I guess why there are different initializations here and you can see this at the end of the training now these in in different layers right here it's pretty much always the same pattern that they they say they just remark it so this this is what I find weird they just say what the graphs show they don't interpret it like I would expect something like oh this pattern is exactly what we would expect from our model because something something something right like if they claim that this attention is being able to be learned I just don't see why they do this stuff they simply point out oh yeah this this is higher here and this is higher here but I don't even see that as too interesting given that is this is how you initialize it like if you shift everything to the left of it and you know this is a wall so it like this piles up here then this is exactly what turns out I don't I don't see you know what what this is supposed to mean especially since they don't make any claim of what it is supposed to mean and the same here they say the effect of the number of heads okay we we investigate the effect and the number of heads on the random synthesizer models you know and they train the number of heads now somewhere in the text they say I remember they say since you know since we don't dynamically route it is very important for our models very crucial to have many attention heads right such that basically you don't have one routing pattern you have many routing patterns that you learn globally so they say it's very important for our model to have many attention heads and I guess that's what they're trying to demonstrate here but again they simply say what's happening they don't interpret it and and they don't compare it to anything they just you know put it here they just put the number and I don't like is this good is this is this bad can you compare it to something and also here in the so here in the original paper they do the same thing here as you can see the number H is the heads and they do ablate this but at the same time they adjust the dimensions of the key and value vectors such that in total they have the same amount of parameters right so they can really investigate is one big attention head better or worse than many small attention heads is there a trade-off and they find here that there is a bit of a trade-off like there is a sweet spot you don't want too many don't want too much because they get too small something like this but first we like we don't know whether or not have they simply changed the heads but left every other parameter the same or have they also adjusted the dimension because if they haven't adjusted the dimensions then this this increase would be absolutely expected because you now have more parameters and if they have adjusted then it can we compare this to you know something because this here is the this is the t5 small this is not the original transformer like is this big is this small and what does it say about the claim that you made that the number of heads is so important for your model can you validate this using this so it's just a bit of like this entire page here it's just they just measure some things and then they state them here and you're somehow supposed to guess what they mean by stating that here okay but that was enough for me ranting so they give some supplementary material right here but in essence what I like about the paper is sort of the thinking that goes into this thinking outside the box asking the fundamental questions about these models do we really need this what do they do I don't think it's super well investigated really from a scientific point like the formulation of hypotheses it simply trains these things and then make some claims but the claims interact you know with the number of parameters here and so on so and they're sort of noisy all around and of course the fact that this thing here turns out to be a fully connected layer in disguise is also pretty funny but I get it it's a fan it's like it's it's more it's not exactly the same thing but it you know yeah all right so that was my take on this paper if you have a different one let me know in the comments for sure I read all of them and at least I try and I've always succeeded so far all right I'll see you next time bye bye
 Hi there! Today we're looking at synthesizer rethinking self-attention in
 transformer models by Yi Tai, Dara Barry, Donald Metzler, Da Cheng Chuan,
 Chih-Zhao and Chih-Ching. These people are of Google research and on a high level
 they're trying to replace the self-attention mechanism which is
 currently a dot product mechanism in a transformer by a sort of a learned
 attention mechanism, therefore eliminating this expensive dot product.
 They test the model and conclude that it sometimes works a bit. So the results
 are sort of inconclusive. But that's the paper on a high level and it's
 fairly cool to go through. As always, if you like content like this, consider
 subscribing and sharing it out.
 Alright, so they say the dot product self-attention is known to be central and
 indispensable to state-of-the-art transformer models. If you don't know
 what a transformer is, it's best I made a video on the attention is all you need
 paper and that explains what a transformer is and what an attention
 mechanism is in detail. But they are right. Of course the attention mechanism
 that is via the dot product of queries and keys is pretty much what makes
 transformers transformers. And they here ask is it really required? Which is a
 bold question in light of that, right? They say they investigate whether or
 not you really need this and they say via extensive experiments we find
 that first random alignment matrices surprisingly perform quite
 competitively and two, learning attention weights from token-token, that means
 query key interactions, which is this dot product interaction, is not that
 important after all. Okay, they propose this new model called synthesizer, a
 model that learns synthetic attention weights without token-token interactions.
 Our experimental results show that synthesizer is competitive against even
 NILA transformer models across a range of tasks.
 Okay, so let's dive in. So what is different here? They're basically
 saying look in each transformer layer boils down to something like
 this, where you have an input sequence X right here and you want to get an output
 sequence Y. And in order to do that you need some sort of this thing, which is
 the attention matrix, multiplied by this thing, which are called the values. And
 we'll explore that a bit deeper over here. So in these transformers it's
 always kind of helpful to visualize yourself the input sequence as sort of
 nodes. And so this would be one layer, we have a five length sequence and we
 want to transform it into the next length five sequence. And maybe it even
 helps to label maybe like A, B, C, D, E. You can just imagine kind of these, of course as
 you go up the layers it doesn't necessarily always correspond to the same
 input token. But the position labeling them is still pretty helpful, I find,
 especially for things like BERT or something like this. So you want to
 transform the sequence that's incoming here into another sequence. And the
 basic mechanism in a transformer, if you go up the layers, is the routing
 of information. So you want to route information around the sequence and
 basically such that at the end the whole sequence knows about every word in the
 sentence, knows about every other word that there is in the sentence, knows
 about the associations between the other words and so on, such that you gain sort
 of, you start out with individual words and that the end, what you want, is sort
 of that every word has a pretty good idea of what's going on with every other
 word. And that's why you continuously, as you go up the layer, route around
 this information. Now the question is how do you route this information? How do you
 know which word goes to which other word? And here maybe the sentence starts with
 the word, let's call Sarah, okay? Sarah and then it goes on and at some point it
 says she. So she is the pronoun and we can also label these Sarah, she. So if we
 want to, if we think how do we route information, it would be
 beneficial for us if the information that there is a word Sarah here in the
 sentence would be routed to the word she, because the word she, it's a pronoun, it
 knows I'm a pronoun and if there is like a person in the sentence that would be
 valuable information for me, like to know what's kind of going on and to
 understand myself better. Basically every word wants to understand itself and it
 kind of calls out for information from the other words. In a transformer this is
 done via what this paper calls this dot product attention and that's the
 follows. Every word, every token emits what is called a key and a value and the
 key and the value are just two vectors. So every word is going to emit two
 vectors. I'm going to draw one at the bottom here and I'm going to draw one at
 the top. Like that. So you can imagine the key as sort of the word advertising
 what it is to other words and so these are the keys down here and you, sorry, the
 top, I think I called it value, that's wrong, it's called a query. You can
 imagine the query as a word asking, describing what it wants from others to
 know. So in that case you'll see that the vector here and the vector here,
 these are now routed by dot product. So the ones that align in the dot product,
 in the angle, they will be routed to each other. So this would be routed here and
 maybe, you know, okay I drew this, this one would be routed here and the others
 would be kind of routed some a bit here and a bit here maybe. Okay it gets
 fuzzy but you get the concept. But in order to do that you basically need to
 pull to put the dot product from every single key with every value, sorry, query.
 And that gives you basically this quadratic dot product that these
 transformers have and that's expensive. Okay so they have a little picture here.
 This is what a vanilla transformer does. Every input here emits two things, a
 query and a key and then there's the dot product attention to decide what's this
 attention matrix. Okay now this attention matrix is then used to aggregate these
 values. So actually every token emits three things, also this value here, which
 is basically, it's not that important but this just describes the information that
 you want to pass on to the next layer and then it goes through this routing
 right here that routes the information to the correct output places and you get
 your output. Now what they propose is something different. They propose this
 dense synthesizer right here where instead of the dot product attention
 every single input here emits a basically a row of this matrix
 directly without having to go through the dot product. That helps a bit if you
 imagine it in our little framework here. So let's draw this again and let's see
 what this synthesizer, by the way they call this the dense synthesizer because
 they have another variant as well. Okay here is our sequence, the lower
 layer we want to transform it in the upper layer. This is the Sarah node
 and this is the she node. So how do we route information now?
 Okay I missed that. In the dense synthesizer framework every token just
 gets to output, basically it already gets to output where it wants information
 from. So every single token here gets to output where it wants information to
 come from and by where because in the original transformer the where was
 basically defined by these inner product. Now the where is just defined by the
 position. So it just says I want information from position 2 and 3 or
 this node here could say I want information from position 5 and 3.
 And this is dependent on which token there is. So each token looks at
 itself and in the case here of she you can imagine this token says well I'm a
 pronoun therefore I may be referring to a person and I know that in the English
 language a person is often at the beginning of the sentence and therefore I
 certainly want information from token from position 0. It doesn't see that
 there is this word Sarah here. It simply can see only the positions 0, 1, 2, 3, 4.
 So it will output, it will basically output, each token here will output an
 L dimensional vector and L here is the length of the sequence. An L dimensional
 vector that already defines the distribution of how you want the
 information. So I want lots of that and then not much of that and maybe it wants
 a bit of that and then not much of that. So each word up here is going to
 emit this L dimensional vector. So each word, each token decides for itself
 where it wants information to come from based purely on what the token
 itself is. And of course in the higher layers this information, like the
 information of what the token is and what else is there gets aggregated and
 that's how computation happens. But in a fundamental level each node looks at
 itself and decides where do I want information from just given what I am
 and not what others are. So this results in you not having to do this
 dot product attention. But of course you lose the information of what's down here.
 You simply go on the positions of the nodes and they formalize this
 like this. So they basically say okay each transformer mechanism needs
 some sort of a softmax over this matrix B right here. This is
 this routing matrix and then G of X is just the values of X. So G is often just
 a linear function. And they say well this B here in the classic transformer is
 computed via this dot product attention. Can't we just simply have a function
 right here that just outputs the B given an X. So you see here XI
 refers to one row. So X here is an L by D matrix and they say the sequence length
 is L. So if you imagine this is the sequence length, every XI
 is a vector here of dimension D. Sort of like a word embedding.
 Now what you want to do is you want to take each individually, run it through
 the function F and then get out an L dimensional vector.
 This is of dimension L. And if you do this with enough of the with all of the X's
 you'll get an L by L matrix which basically is now your routing matrix.
 So this thing tells you that this particular piece in the input
 sequence wants how much information from this particular piece in the output
 sequence or vice versa. See this is the problem here. They don't really
 specify this B, how this B matrix will be composed from the B I.
 Is B I a column or a row of this B matrix? I don't know. And therefore it
 could actually be the other way around. That's the information, it's not the
 sort of the tokens deciding where they want information from but it could be
 the tokens deciding where they want to send information to. But just from the
 notation I can sort of guess that it's the way that I described right here. But
 I hope you see the difference here. Before we had this dot product
 here each of these columns basically is an independent evaluation of this
 function that only considers X I and doesn't consider any of the X J that it
 wants information from. It simply goes by position. And they use for this, they use
 this basically this two layer, one hidden layer neural network right here. Two
 weight matrices and a non-linearity, a ReLU non-linearity. So they replace the
 dot product by simply learning what the attention pattern is going to be per
 individual token. Now they do it one step further. They say okay so we've
 already lost the dependency basically on what the input sequence
 tokens here are. Can't we also just kind of lose the dependency of what the
 output token sequences here are? So what they propose in their second variant,
 this random synthesizer, is the following. Why don't we just learn how
 the information is going to be routed, irrespective of which tokens come in?
 We're just gonna learn this and it's going to be one routing
 pattern for all of the possible input output sequences. It's just going
 to be this routing pattern. So they have actually two variants. First one where it
 is really just random, like they just leave it random and they don't even
 train it. And the second one where they train this thing. But these things now
 have nothing to do with the tokens. They're just fixed and they are just
 global. So this would directly be, you learn this L by L
 matrix. So if this strikes you a bit in an odd way, because you kind of
 lose the dependency on your data in this routing pattern and it's not really
 routing anymore, and if you think that you've seen this before somewhere
 and you think, hey that looks like a feet forward layer from your
 very first MLP, then you would be absolutely correct. And I'm not sure why
 they don't point this out. I have a really hard time believing that
 they themselves tricked them into such a thing right here. So I can
 actually show it. So the question is how is this here, this dense
 synthesizer, is this still different or the same as a feet
 forward layer? And is this different or the same as a feet forward layer? So if
 you do the math and you look at what a feet forward layer is, in a
 feet forward layer, yi, my i-th entry in the output, is going to be a sum
 over all the inputs xj multiplied by a weight ij. So whenever I can
 represent something in this fashion, where I have a sum and then I have like
 a fixed weight that I learn and that has nothing to do with x, that is not
 dependent on x, multiplied by x, then it is a feet forward layer basically, or
 like a fancy feet forward layer. So let's look at the dense synthesizer. What does
 the dense synthesizer do? The dense synthesizer says yi is equal to a sum.
 Okay we're starting off, we're starting off well. And so it says g of xj,
 but this g usually is just a weight matrix where we compute the values.
 We said this was the values of x. So g is usually just a matrix, let's call it
 vw. And then here we have like some softmax thing. We have some softmax
 and the softmax is going to be over this dense pattern right here that we
 described here. And this pattern is going to be f of xj. So no, xi, f of
 xi. Is that correct? Xi and here is a j. Maybe. Yes, that's correct. And f, okay,
 it's like two, it's two layers, but we can basically say it's like a weight
 matrix. Because ultimately if we learn a neural network or a single layer, it
 doesn't really matter to the discussion here. So let's call this wb xi. So you
 see right here we do have a weighted sum over the xjs, but the weight that the
 weighted sum is using is dependent on xi right here. And therefore you can't
 represent this as just a feet forward layer right here. Of course if you have
 the full dot product attention, then in here would actually be a dot product
 between xj and xi, right? So xj transposed xi or something like this. So
 what about this random synthesizer? So the random synthesizer has yi, has a
 weighted sum over this wv xi, that's the values, softmax over this matrix R. And R
 is simply this L by L matrix right here. Now you can immediately see that this
 part right here is static, it doesn't depend on any x and it is learned as a
 joint function, right? So this, if I just call this w, wij, then I'm back to my
 formulation, right? I'm sorry, ij. Then I basically have my feet forward layer. So
 the random synthesizer is just a fancy way of writing a feet forward layer. Now
 of course if you're going to have the softmax you maybe have some different
 inductive biases in learning it, but ultimately it is a straightforward
 feet forward layer. At least that's what it looks like to me. I am very open to be
 convinced otherwise. Okay so they have this drawing right here on the left you
 see the vanilla transformer, the dense synthesizer in the middle where you kind
 of learn how to produce this matrix and then route the value through it. And on
 the right where you simply output this in a learned or actually completely
 random fashion and then route your values through that to the output. Okay
 now the question of course is, okay they also do factorize it, but this is not
 really the... this is more of a point where now you can actually, if you have such a
 matrix or you produce such a matrix, you can then factorize it into sort of
 lower dimensional matrices. And that is first of all to save space and it is
 also a regularizer because what you're essentially saying is you're applying an
 inductive prior to say I think these matrices have like some low level
 structure to them and if you factorize them that's a prior on that
 exactly. So you can factorize the dense and the random synthesizer into smaller
 matrices and that will save you parameters. And you can actually also
 mix two. So you can for example mix the random and the dense synthesizer. Now you
 have to pay attention it's not like an interpolation. If you mix random and
 dense you will have to learn the parameters of the random end of the
 dense synthesizer. So that's going to be like strictly more powerful than either
 one alone. They list everything here where they say the standard dot product
 attention. What we have is we have this formula right here you can actually
 formulate it in their framework. You condition on all the Xj for any Xi and
 ah see here I wrote this as Xj I was dumb. It should be the entire X. And there
 is interaction between the tokens and it's going to cost you 2d squared
 parameters. Now parameters are different from computation which if you don't do
 the dot product you also save a bunch of computation but here they look at a
 number of parameters. So in this random synthesizer you simply output this
 matrix R. It's global. There's no interaction and you are you are it's
 cost you L squared memory in L squared parameters. Now often in these models L
 and D are actually pretty similar. So L might be something like 512 tokens the
 length and the dimension right here might also be something like 512. So per
 se this is not really a saving in parameters only when you go to the to
 the factorized models right here. Can you bring in this K and K is this lower
 dimension of factorization and if K is much much smaller than L then you save a
 bunch of parameters. The dense synthesizer formula is like this. This
 is how you produce the attention matrix. You condition on XI but not Xj right?
 For each YI you condition on XI and you do not care about the Xjs. It is
 local that means it depends on XI so the routing actually depends on
 the information that goes through but there is no interaction and you're going
 into D squared plus DL which is also pretty much 2D squared. Or you
 go to this lower number here if you choose a good K. Alright now
 experiments. So they apply this and we are absolutely stoked how this is going
 to turn out. So they go on machine translation. Now okay before we go into
 the results do you think machine translation is a good or a bad task for
 this model? Okay I think it is a good task for this model. It is a very favorable
 task for this model. Why? Why is machine translation a favorable task? Well mostly
 in machine translation if you think about how information is routed. So I
 have a sequence of German. Let's call it or English let's call it
 the dog barks. And I have a sequence of German. Der Hund belt. Come on. Hund belt.
 Now okay first of all I know they are only talking about self-attention so
 this example here actually makes little sense in the actual practical
 applications but I just want to demonstrate why machine translation
 specifically has... So how would you route information here if you have to route
 information between the two things? What you would do is pretty
 deterministically do this right? So in machine translation what is very very
 very often the case is that mostly you're going to align the positions in
 the same way independent of the input. Specifically here you would always most
 of the time align the beginning with the beginning the end with the end and so on
 because for most languages especially similar languages like English and
 German the order of sentences and number of words per thing you need to express
 is going to be roughly the same. So if you did not know about even about what
 the sequences were or you only knew one of them like you only knew there and you
 have to guess where should information come from well I know in English you
 also start with like this what's this called an article yeah it yes this is an
 article showing my linguistic skills here you you would also you would also
 start with that right you would say I want most information from position zero
 obviously I don't care what there what what is there so I and again I know they
 only do it in self-attention so it actually makes no sense that I have two
 different languages here but machine translation is probably a task that lends
 itself very much to sort of global globally learned or only partially
 partial observably learned attention patterns because just because of the
 nature of the task right so let's keep that in mind and go to the go to the
 results right here now they first of all what they do is they list the original
 transformer paper and actually have it here because they have to they have this
 same experiment now this is the kind of transformer we're talking about right
 here and it is notable that this paper only proposes to replace the self
 attention that means the attention that would be within one of these two columns
 and not the attention that goes across from the left to the right right but
 still you can see that the attention that goes from the left to the right then
 in the next layer is going to end up as self-attention information right so my I
 think my argument still counts in the in this case in the machine translation
 case alright so they have this same experiment right here here yes they have
 English German translation and they their base model gets twenty seven point
 three and that's what they evaluate right here they list this twenty seven
 point three but they also say when we train it we get a bit of a higher
 number twenty seven point six seven and especially on English French they get a
 higher number than that but let's stick to English German for now now they also
 do language modeling which the original paper didn't do and record the perplexity
 right here okay so the first thing they point out is if we train the synthesizer
 with a fixed random matrix that means we just put a random routing and we do not
 we do not ever change it what's there to learn so if you want to learn something
 in the transformer there's still many things to learn there's the feet
 forward layers right there is the the value encoder and so on so it is it is
 reasonable to assume that the transformer could sort of learn to just
 handle the attend the routing pattern that is in place that did the rest of
 the model can sort of absorb that shock and interestingly you get on to twenty
 three point nine so almost twenty four blue points and I mean it seems they
 point out that it's fairly close if you look here this twenty four is actually
 pretty far away it's the worst the worst baseline right here in the original
 paper despite net had this twenty four blue I mean it's I guess it's cool to
 point out that it works as such but you know in these tasks actually many things
 work right with with if you distill this down to some sort of a bag of words
 model and so on I'm pretty sure you can get pretty pretty good results as well
 and you can get you know fairly you can go to twenty four blue actually have no
 clue of this field but I just want to point out just because the number is in
 the same ballpark doesn't mean that it is very astonishing it's maybe just you
 have so many parameters that the rest of the model can sort of absorb this shock
 of not of not being able to learn this and can just handle whatever pattern you
 put there it can just kind of work with it
 that's many people have observed if you like put just random junk in the lower
 layers of a CNN like random filters never train them you can still the rest
 of the network can adapt so that's basically this effect right here I don't
 think it's a testament to we don't need the dot product attention it's more like
 this this just happens in deep learning then however they say if we now learn
 this one matrix so we learn this routing but globally we get into twenty seven
 point two seven blue and this already seems fairly close right and you mainly
 need to compare with this number right here because that's actually the same
 training run and so on so but still it is quite it is quite a bit away it's
 point four blue points away and that is a sort of significant difference I think
 then they go further if they go to the dense synthesizer you can see right here
 the model size is lower than this one and they get twenty seven point four three
 now they get even closer right and they are actually on par if they mix random
 and dense right here and you can see that it's also almost the same amount of
 parameters and when they mix these random and vanilla so what they now have
 is the dot product attention plus a purely global feed-forward sort of like
 a bias of what to route where then they can out compete this original model but
 also now they have more parameters right so this model you would expect it to be
 you know strictly better than either of the two alone and it is and it is
 actually astounding that the synthesizer that mixes the vanilla with the dense
 even though it has even more parameters it does worse so with these sort of
 results especially then you go fiddle with like point one you know between
 this and that I know I said point four blow is a lot so point one must be
 something and it surely is but also it's always the question of how many hyper
 parameter tunings you put into something like this and generally you you should
 always sort of look at this if you were a researcher had to put the best possible
 numbers here what would you do and then you correct for that in your mind for
 how much it might actually work if you if you are to if you are to you know go
 ahead and and train that on your data but nevertheless it gives some cool
 insights right what I'm a bit confused by is that if you sort of look at the
 original paper and you look at the perplexities and they have a table down
 here where they compare a bunch of their instantiations of their model and you
 compare the comparison the perplexity on a language modeling task and the
 perplexity here seems to correlate extremely well with the blue score
 right where as the perplexity here if you look at the perplexities over here
 they do correlate but I somehow I have the feeling they don't really correlate
 as much here which sort of speaks to the fact that you're going to see in the
 rest of the paper that these models they tend to sometimes be able to do well but
 then other times not and it's not really clear super clear when so look at this
 for example they now apply their models to summarization and dialogue generation
 right these are two tasks where you need to output text and you can see that the
 results are all over the place so in this metric Rouge to and Rouge is sort
 of an engram overlap metric between gold standards and what you produce in this
 metric the original transformer is best but in Rouge one this synthesizer mixed
 here is the best and in Rouge L this one is the best and in dialogue generation
 all of them are actually not as good as this one right here where it's just the
 dense which is strictly less powerful than the ones on the bottom but so as
 you as you can see yeah I think what you should take away from this is that it it
 is interesting that it sometimes works but it seems to be a fair bit of
 shakiness to these to these results okay now they go on and they test this on
 super glue and this is a benchmark so glue and super glue they consist of
 these different tasks right here and now we are out of the text generation game
 we are in the game of for example you have two sentences and you need to
 decide which which one is like which one entails the other or are they
 contradictory or things like this so it's more of a late say a classification
 task and people apply different models so it's no longer a text generation task
 so they switch model instead of the vanilla transformer from the attention
 is all you need paper they now go on to the t5 the text to text transformer and
 they change they simply take the architecture and they change the
 attention in there with their attention and you can see right here that the
 results are quite different than before so in every single case either the t5
 model the base model with the dot product attention is the best model or
 the synthesizer but including V so plus V means plus vanilla means it also has
 the dot product attention plus this learned thing right here okay so our is
 now the learned I think the learned right I would be surprised if it was the
 random random but it could also be but in any case it's strictly better right
 it's strictly more powerful model and the only way you can actually perform
 worse is when you know it's too many parameters and so on and they kind of
 take stuff from each other and there is effects where more parameters can hurt
 you but never is any model that doesn't have the dot product attention on on top
 and these authors here argue that that's this can be largely attributed to the
 fact that the encoder self-attention in the t5 setting also functions as a
 cross-sentence attention so what do they mean here if in the t5 is just as I
 understand it this is just like an encoder like Bert so imagine imagine
 maybe this is Bert right what Bert is simply an encoder only transformer that
 means you here you put in your sequence and out again comes a sequence and you
 have like a special token that you use for classification and so on so this is
 less when you have to generate text but more when you want to classify text or
 things like this find something in a text and what you would do if you have
 two sentences you need to decide something about them you put the first
 sentence here and then you say you put like a separator token here this usually
 called like a separator token and then you put the second sentence here is you
 just concatenate them and you let them go into the transformer and they argue
 that if you do self-attention on this entire sequence then you get attention
 patterns like this and this is sort of like cross-attention between sequences
 right it's not really self-attention and that's why their method doesn't work
 because it basically deals with self-attention but I'm not really buying
 that argument I mean if this is a sequence it is if this is one sequence
 this is self-attention and if you were going to argue that out of the blue a
 token in your case like in your original formulation can simply you know just by
 looking at itself know where where which position it wants the information from
 and certainly here this token could also learn that it wants information from
 over here or from the first word here I don't I don't really see the difference
 maybe maybe you need to somehow standardize where this separator token
 is so that it's always in the same place and that the second sentence always
 starts at the same place but if you have that then I really don't see any
 difference in the argument you can make here that this shouldn't work as much as
 the others what I think is happening is that this task is simply involves more
 difficult reasoning involves more routing of information like dynamic
 routing that's actually dependent on what's in the tasks rather than
 something like machine translation which most of the time has some global
 routing bias like like some some pattern that works pretty well across all alright
 so the last part here is where they kind of introspect the model and in the in
 the first thing they say okay we look at the distribution of weights so these are
 the weights the weights in the decoder at the beginning of training and you can
 already see that the standard transformer weights are and the
 synthesizer weights are different from the sorry the dense synthesizer weights
 are different from the random synthesizer weights and this probably is
 mostly due to the fact of how you initialize like these deep learning
 frameworks if you have a matrix they will look at what's this dimension
 what's this dimension and calculate how they have to initialize it such that
 sort of the the total norm of a random vector that goes through stays the same
 sorry the vector would go through like it would go in here and out there so you
 see if it changes dimension then if you just randomly initialize with all the
 same like every matrix with the same number then like with the normal
 distribution then the in this case the vector would gain in norm and to account
 for that you initialize the matrices such that the vector norms approximately
 stay the same and this is why there I guess why there are different
 initializations here and you can see this at the end of the training now these
 in in different layers right here it's pretty much always the same pattern that
 they they say they just remark it so this this is what I find weird they just
 say what the graphs show they don't interpret it like I would expect
 something like oh this pattern is exactly what we would expect from our
 model because something something something right like if they claim that
 this attention is being able to be learned I just don't see why they do this
 stuff they simply point out oh yeah this this is higher here and this is higher
 here but I don't even see that as too interesting given that is this is how
 you initialize it like if you shift everything to the left of it and you
 know this is a wall so it like this piles up here then this is exactly what
 turns out I don't I don't see you know what what this is supposed to mean
 especially since they don't make any claim of what it is supposed to mean and
 the same here they say the effect of the number of heads okay we we investigate
 the effect and the number of heads on the random synthesizer models you know
 and they train the number of heads now somewhere in the text they say I remember
 they say since you know since we don't dynamically route it is very important
 for our models very crucial to have many attention heads right such that
 basically you don't have one routing pattern you have many routing patterns
 that you learn globally so they say it's very important for our model to have
 many attention heads and I guess that's what they're trying to demonstrate here
 but again they simply say what's happening they don't interpret it and
 and they don't compare it to anything they just you know put it here they just
 put the number and I don't like is this good is this is this bad can you compare
 it to something and also here in the so here in the original paper they do the
 same thing here as you can see the number H is the heads and they do ablate
 this but at the same time they adjust the dimensions of the key and value
 vectors such that in total they have the same amount of parameters right so they
 can really investigate is one big attention head better or worse than many
 small attention heads is there a trade-off and they find here that there
 is a bit of a trade-off like there is a sweet spot you don't want too many don't
 want too much because they get too small something like this but first we like we
 don't know whether or not have they simply changed the heads but left every
 other parameter the same or have they also adjusted the dimension because if
 they haven't adjusted the dimensions then this this increase would be
 absolutely expected because you now have more parameters and if they have
 adjusted then it can we compare this to you know something because this here is
 the this is the t5 small this is not the original transformer like is this big is
 this small and what does it say about the claim that you made that the number
 of heads is so important for your model can you validate this using this so it's
 just a bit of like this entire page here it's just they just measure some things
 and then they state them here and you're somehow supposed to guess what they mean
 by stating that here okay but that was enough for me ranting so they give some
 supplementary material right here but in essence what I like about the paper is
 sort of the thinking that goes into this thinking outside the box asking the
 fundamental questions about these models do we really need this what do they do I
 don't think it's super well investigated really from a scientific point like the
 formulation of hypotheses it simply trains these things and then make some
 claims but the claims interact you know with the number of parameters here and so
 on so and they're sort of noisy all around and of course the fact that this
 thing here turns out to be a fully connected layer in disguise is also
 pretty funny but I get it it's a fan it's like it's it's more it's not exactly
 the same thing but it you know yeah all right so that was my take on this paper
 if you have a different one let me know in the comments for sure I read all of
 them and at least I try and I've always succeeded so far all right I'll see you
 next time bye bye